/** auxui-v1.0.0  MIT License By http://auxui.aimlt.com */
define('element', ['jquery'], function($) {
    var element = new Object();

    + function($) {
        'use strict';
        var Modal = function(element, options) {
            this.options = options
            this.$body = $(document.body)
            this.$element = $(element)
            this.$dialog = this.$element.find('.modal-dialog')
            this.$backdrop = null
            this.isShown = null
            this.originalBodyPad = null
            this.scrollbarWidth = 0
            this.ignoreBackdropClick = false
            if (this.options.remote) {
                this.$element
                    .find('.modal-content')
                    .load(this.options.remote, $.proxy(function() {
                        this.$element.trigger('loaded.bs.modal')
                    }, this))
            }
        }

        Modal.VERSION = '3.3.7'

        Modal.TRANSITION_DURATION = 300
        Modal.BACKDROP_TRANSITION_DURATION = 150

        Modal.DEFAULTS = {
            backdrop: true,
            keyboard: true,
            show: true
        }

        Modal.prototype.toggle = function(_relatedTarget) {
            return this.isShown ? this.hide() : this.show(_relatedTarget)
        }

        Modal.prototype.show = function(_relatedTarget) {
            var that = this
            var e = $.Event('show.bs.modal', {
                relatedTarget: _relatedTarget
            })

            this.$element.trigger(e)

            if (this.isShown || e.isDefaultPrevented()) return

            this.isShown = true

            this.checkScrollbar()
            this.setScrollbar()
            this.$body.addClass('modal-open')

            this.escape()
            this.resize()

            this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))

            this.$dialog.on('mousedown.dismiss.bs.modal', function() {
                that.$element.one('mouseup.dismiss.bs.modal', function(e) {
                    if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true
                })
            })

            this.backdrop(function() {
                var transition = $.support.transition && that.$element.hasClass('fade')

                if (!that.$element.parent().length) {
                    that.$element.appendTo(that.$body)
                }

                that.$element
                    .show()
                    .scrollTop(0)

                that.adjustDialog()

                if (transition) {
                    that.$element[0].offsetWidth
                }

                that.$element.addClass('in')

                that.enforceFocus()

                var e = $.Event('shown.bs.modal', {
                    relatedTarget: _relatedTarget
                })

                transition ?
                    that.$dialog
                    .one('bsTransitionEnd', function() {
                        that.$element.trigger('focus').trigger(e)
                    })
                    .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
                    that.$element.trigger('focus').trigger(e)
            })
        }

        Modal.prototype.hide = function(e) {
            if (e) e.preventDefault()

            e = $.Event('hide.bs.modal')

            this.$element.trigger(e)

            if (!this.isShown || e.isDefaultPrevented()) return

            this.isShown = false

            this.escape()
            this.resize()

            $(document).off('focusin.bs.modal')

            this.$element
                .removeClass('in')
                .off('click.dismiss.bs.modal')
                .off('mouseup.dismiss.bs.modal')

            this.$dialog.off('mousedown.dismiss.bs.modal')

            $.support.transition && this.$element.hasClass('fade') ?
                this.$element
                .one('bsTransitionEnd', $.proxy(this.hideModal, this))
                .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
                this.hideModal()
        }

        Modal.prototype.enforceFocus = function() {
            $(document)
                .off('focusin.bs.modal')
                .on('focusin.bs.modal', $.proxy(function(e) {
                    if (document !== e.target &&
                        this.$element[0] !== e.target &&
                        !this.$element.has(e.target).length) {
                        this.$element.trigger('focus')
                    }
                }, this))
        }

        Modal.prototype.escape = function() {
            if (this.isShown && this.options.keyboard) {
                this.$element.on('keydown.dismiss.bs.modal', $.proxy(function(e) {
                    e.which == 27 && this.hide()
                }, this))
            } else if (!this.isShown) {
                this.$element.off('keydown.dismiss.bs.modal')
            }
        }

        Modal.prototype.resize = function() {
            if (this.isShown) {
                $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))
            } else {
                $(window).off('resize.bs.modal')
            }
        }

        Modal.prototype.hideModal = function() {
            var that = this
            this.$element.hide()
            this.backdrop(function() {
                that.$body.removeClass('modal-open')
                that.resetAdjustments()
                that.resetScrollbar()
                that.$element.trigger('hidden.bs.modal')
            })
        }

        Modal.prototype.removeBackdrop = function() {
            this.$backdrop && this.$backdrop.remove()
            this.$backdrop = null
        }

        Modal.prototype.backdrop = function(callback) {
            var that = this
            var animate = this.$element.hasClass('fade') ? 'fade' : ''

            if (this.isShown && this.options.backdrop) {
                var doAnimate = $.support.transition && animate

                this.$backdrop = $(document.createElement('div'))
                    .addClass('modal-backdrop ' + animate)
                    .appendTo(this.$body)

                this.$element.on('click.dismiss.bs.modal', $.proxy(function(e) {
                    if (this.ignoreBackdropClick) {
                        this.ignoreBackdropClick = false
                        return
                    }
                    if (e.target !== e.currentTarget) return
                    this.options.backdrop == 'static' ? this.$element[0].focus() : this.hide()
                }, this))

                if (doAnimate) this.$backdrop[0].offsetWidth

                this.$backdrop.addClass('in')

                if (!callback) return

                doAnimate ?
                    this.$backdrop
                    .one('bsTransitionEnd', callback)
                    .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
                    callback()

            } else if (!this.isShown && this.$backdrop) {
                this.$backdrop.removeClass('in')

                var callbackRemove = function() {
                    that.removeBackdrop()
                    callback && callback()
                }
                $.support.transition && this.$element.hasClass('fade') ?
                    this.$backdrop
                    .one('bsTransitionEnd', callbackRemove)
                    .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
                    callbackRemove()

            } else if (callback) {
                callback()
            }
        }

        Modal.prototype.handleUpdate = function() {
            this.adjustDialog()
        }

        Modal.prototype.adjustDialog = function() {
            var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight

            this.$element.css({
                paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
                paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''
            })
        }

        Modal.prototype.resetAdjustments = function() {
            this.$element.css({
                paddingLeft: '',
                paddingRight: ''
            })
        }

        Modal.prototype.checkScrollbar = function() {
            var fullWindowWidth = window.innerWidth
            if (!fullWindowWidth) {
                var documentElementRect = document.documentElement.getBoundingClientRect()
                fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left)
            }
            this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth
            this.scrollbarWidth = this.measureScrollbar()
        }

        Modal.prototype.setScrollbar = function() {
            var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
            this.originalBodyPad = document.body.style.paddingRight || ''
            if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
        }

        Modal.prototype.resetScrollbar = function() {
            this.$body.css('padding-right', this.originalBodyPad)
        }

        Modal.prototype.measureScrollbar = function() {
            var scrollDiv = document.createElement('div')
            scrollDiv.className = 'modal-scrollbar-measure'
            this.$body.append(scrollDiv)
            var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
            this.$body[0].removeChild(scrollDiv)
            return scrollbarWidth
        }

        function Plugin(option, _relatedTarget) {
            return this.each(function() {
                var $this = $(this)
                var data = $this.data('bs.modal')
                var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)

                if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
                if (typeof option == 'string') data[option](_relatedTarget)
                else if (options.show) data.show(_relatedTarget)
            })
        }

        var old = $.fn.modal

        $.fn.modal = Plugin
        $.fn.modal.Constructor = Modal

        $.fn.modal.noConflict = function() {
            $.fn.modal = old
            return this
        }

        $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function(e) {
            var $this = $(this)
            var href = $this.attr('href')
            var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, '')))
            var option = $target.data('bs.modal') ? 'toggle' : $.extend({
                remote: !/#/.test(href) && href
            }, $target.data(), $this.data())

            if ($this.is('a')) e.preventDefault()

            $target.one('show.bs.modal', function(showEvent) {
                if (showEvent.isDefaultPrevented()) return
                $target.one('hidden.bs.modal', function() {
                    $this.is(':visible') && $this.trigger('focus')
                })
            })
            Plugin.call($target, option, this)
        });

    }(jQuery);

    /* ========================================================================
     * 下载菜单
     * ======================================================================== */
    +function($) {
        'use strict';

        var backdrop = '.dropdown-backdrop'
        var toggle = '[data-toggle="dropdown"]'
        var Dropdown = function(element) {
            $(element).on('click.bs.dropdown', this.toggle)
        }

        Dropdown.VERSION = '3.3.7'

        function getParent($this) {
            var selector = $this.attr('data-target')

            if (!selector) {
                selector = $this.attr('href')
                selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
            }

            var $parent = selector && $(selector)

            return $parent && $parent.length ? $parent : $this.parent()
        }

        function clearMenus(e) {
            if (e && e.which === 3) return
            $(backdrop).remove()
            $(toggle).each(function() {
                var $this = $(this)
                var $parent = getParent($this)
                var relatedTarget = { relatedTarget: this }

                if (!$parent.hasClass('open')) return

                if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return

                $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))

                if (e.isDefaultPrevented()) return

                $this.attr('aria-expanded', 'false')
                $parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget))
            })
        }

        Dropdown.prototype.toggle = function(e) {
            var $this = $(this)

            if ($this.is('.disabled, :disabled')) return

            var $parent = getParent($this)
            var isActive = $parent.hasClass('open')

            clearMenus()

            if (!isActive) {
                if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
                    $(document.createElement('div'))
                        .addClass('dropdown-backdrop')
                        .insertAfter($(this))
                        .on('click', clearMenus)
                }

                var relatedTarget = { relatedTarget: this }
                $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))

                if (e.isDefaultPrevented()) return

                $this
                    .trigger('focus')
                    .attr('aria-expanded', 'true')

                $parent
                    .toggleClass('open')
                    .trigger($.Event('shown.bs.dropdown', relatedTarget))
            }

            return false
        }

        Dropdown.prototype.keydown = function(e) {
            if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return

            var $this = $(this)

            e.preventDefault()
            e.stopPropagation()

            if ($this.is('.disabled, :disabled')) return

            var $parent = getParent($this)
            var isActive = $parent.hasClass('open')

            if (!isActive && e.which != 27 || isActive && e.which == 27) {
                if (e.which == 27) $parent.find(toggle).trigger('focus')
                return $this.trigger('click')
            }

            var desc = ' li:not(.disabled):visible a'
            var $items = $parent.find('.dropdown-menu' + desc)

            if (!$items.length) return

            var index = $items.index(e.target)

            if (e.which == 38 && index > 0) index-- // up
                if (e.which == 40 && index < $items.length - 1) index++ // down
                    if (!~index) index = 0

            $items.eq(index).trigger('focus')
        }

        function Plugin(option) {
            return this.each(function() {
                var $this = $(this)
                var data = $this.data('bs.dropdown')

                if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
                if (typeof option == 'string') data[option].call($this)
            })
        }

        var old = $.fn.dropdown

        $.fn.dropdown = Plugin
        $.fn.dropdown.Constructor = Dropdown

        $.fn.dropdown.noConflict = function() {
            $.fn.dropdown = old
            return this
        }

        $(document)
            .on('click.bs.dropdown.data-api', clearMenus)
            .on('click.bs.dropdown.data-api', '.dropdown form', function(e) { e.stopPropagation() })
            .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
            .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
            .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown)

    }(jQuery);

    /* ========================================================================
     * 提示工具
     * ======================================================================== */
    +function($) {
        'use strict';

        var Tooltip = function(element, options) {
            this.type = null
            this.options = null
            this.enabled = null
            this.timeout = null
            this.hoverState = null
            this.$element = null
            this.inState = null

            this.init('tooltip', element, options)
        }

        Tooltip.VERSION = '3.3.7'

        Tooltip.TRANSITION_DURATION = 150

        Tooltip.DEFAULTS = {
            animation: true,
            placement: 'top',
            selector: false,
            template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
            trigger: 'hover focus',
            title: '',
            delay: 0,
            html: false,
            container: false,
            viewport: {
                selector: 'body',
                padding: 0
            }
        }

        Tooltip.prototype.init = function(type, element, options) {
            this.enabled = true
            this.type = type
            this.$element = $(element)
            this.options = this.getOptions(options)
            this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
            this.inState = { click: false, hover: false, focus: false }

            if (this.$element[0] instanceof document.constructor && !this.options.selector) {
                throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
            }

            var triggers = this.options.trigger.split(' ')

            for (var i = triggers.length; i--;) {
                var trigger = triggers[i]

                if (trigger == 'click') {
                    this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
                } else if (trigger != 'manual') {
                    var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
                    var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'

                    this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
                    this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
                }
            }

            this.options.selector ?
                (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
                this.fixTitle()
        }

        Tooltip.prototype.getDefaults = function() {
            return Tooltip.DEFAULTS
        }

        Tooltip.prototype.getOptions = function(options) {
            options = $.extend({}, this.getDefaults(), this.$element.data(), options)

            if (options.delay && typeof options.delay == 'number') {
                options.delay = {
                    show: options.delay,
                    hide: options.delay
                }
            }

            return options
        }

        Tooltip.prototype.getDelegateOptions = function() {
            var options = {}
            var defaults = this.getDefaults()

            this._options && $.each(this._options, function(key, value) {
                if (defaults[key] != value) options[key] = value
            })

            return options
        }

        Tooltip.prototype.enter = function(obj) {
            var self = obj instanceof this.constructor ?
                obj : $(obj.currentTarget).data('bs.' + this.type)

            if (!self) {
                self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
                $(obj.currentTarget).data('bs.' + this.type, self)
            }

            if (obj instanceof $.Event) {
                self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true
            }

            if (self.tip().hasClass('in') || self.hoverState == 'in') {
                self.hoverState = 'in'
                return
            }

            clearTimeout(self.timeout)

            self.hoverState = 'in'

            if (!self.options.delay || !self.options.delay.show) return self.show()

            self.timeout = setTimeout(function() {
                if (self.hoverState == 'in') self.show()
            }, self.options.delay.show)
        }

        Tooltip.prototype.isInStateTrue = function() {
            for (var key in this.inState) {
                if (this.inState[key]) return true
            }

            return false
        }

        Tooltip.prototype.leave = function(obj) {
            var self = obj instanceof this.constructor ?
                obj : $(obj.currentTarget).data('bs.' + this.type)

            if (!self) {
                self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
                $(obj.currentTarget).data('bs.' + this.type, self)
            }

            if (obj instanceof $.Event) {
                self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false
            }

            if (self.isInStateTrue()) return

            clearTimeout(self.timeout)

            self.hoverState = 'out'

            if (!self.options.delay || !self.options.delay.hide) return self.hide()

            self.timeout = setTimeout(function() {
                if (self.hoverState == 'out') self.hide()
            }, self.options.delay.hide)
        }

        Tooltip.prototype.show = function() {
            var e = $.Event('show.bs.' + this.type)

            if (this.hasContent() && this.enabled) {
                this.$element.trigger(e)

                var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
                if (e.isDefaultPrevented() || !inDom) return
                var that = this

                var $tip = this.tip()

                var tipId = this.getUID(this.type)

                this.setContent()
                $tip.attr('id', tipId)
                this.$element.attr('aria-describedby', tipId)

                if (this.options.animation) $tip.addClass('fade')

                var placement = typeof this.options.placement == 'function' ?
                    this.options.placement.call(this, $tip[0], this.$element[0]) :
                    this.options.placement

                var autoToken = /\s?auto?\s?/i
                var autoPlace = autoToken.test(placement)
                if (autoPlace) placement = placement.replace(autoToken, '') || 'top'

                $tip
                    .detach()
                    .css({ top: 0, left: 0, display: 'block' })
                    .addClass(placement)
                    .data('bs.' + this.type, this)

                this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
                this.$element.trigger('inserted.bs.' + this.type)

                var pos = this.getPosition()
                var actualWidth = $tip[0].offsetWidth
                var actualHeight = $tip[0].offsetHeight

                if (autoPlace) {
                    var orgPlacement = placement
                    var viewportDim = this.getPosition(this.$viewport)

                    placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' :
                        placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' :
                        placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' :
                        placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' :
                        placement

                    $tip
                        .removeClass(orgPlacement)
                        .addClass(placement)
                }

                var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)

                this.applyPlacement(calculatedOffset, placement)

                var complete = function() {
                    var prevHoverState = that.hoverState
                    that.$element.trigger('shown.bs.' + that.type)
                    that.hoverState = null

                    if (prevHoverState == 'out') that.leave(that)
                }

                $.support.transition && this.$tip.hasClass('fade') ?
                    $tip
                    .one('bsTransitionEnd', complete)
                    .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
                    complete()
            }
        }

        Tooltip.prototype.applyPlacement = function(offset, placement) {
            var $tip = this.tip()
            var width = $tip[0].offsetWidth
            var height = $tip[0].offsetHeight

            var marginTop = parseInt($tip.css('margin-top'), 10)
            var marginLeft = parseInt($tip.css('margin-left'), 10)

            if (isNaN(marginTop)) marginTop = 0
            if (isNaN(marginLeft)) marginLeft = 0

            offset.top += marginTop
            offset.left += marginLeft

            $.offset.setOffset($tip[0], $.extend({
                using: function(props) {
                    $tip.css({
                        top: Math.round(props.top),
                        left: Math.round(props.left)
                    })
                }
            }, offset), 0)

            $tip.addClass('in')


            var actualWidth = $tip[0].offsetWidth
            var actualHeight = $tip[0].offsetHeight

            if (placement == 'top' && actualHeight != height) {
                offset.top = offset.top + height - actualHeight
            }

            var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)

            if (delta.left) offset.left += delta.left
            else offset.top += delta.top

            var isVertical = /top|bottom/.test(placement)
            var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
            var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'

            $tip.offset(offset)
            this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
        }

        Tooltip.prototype.replaceArrow = function(delta, dimension, isVertical) {
            this.arrow()
                .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')
                .css(isVertical ? 'top' : 'left', '')
        }

        Tooltip.prototype.setContent = function() {
            var $tip = this.tip()
            var title = this.getTitle()

            $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
            $tip.removeClass('fade in top bottom left right')
        }

        Tooltip.prototype.hide = function(callback) {
            var that = this
            var $tip = $(this.$tip)
            var e = $.Event('hide.bs.' + this.type)

            function complete() {
                if (that.hoverState != 'in') $tip.detach()
                if (that.$element) {
                    that.$element
                        .removeAttr('aria-describedby')
                        .trigger('hidden.bs.' + that.type)
                }
                callback && callback()
            }

            this.$element.trigger(e)

            if (e.isDefaultPrevented()) return

            $tip.removeClass('in')

            $.support.transition && $tip.hasClass('fade') ?
                $tip
                .one('bsTransitionEnd', complete)
                .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
                complete()

            this.hoverState = null

            return this
        }

        Tooltip.prototype.fixTitle = function() {
            var $e = this.$element
            if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {
                $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
            }
        }

        Tooltip.prototype.hasContent = function() {
            return this.getTitle()
        }

        Tooltip.prototype.getPosition = function($element) {
            $element = $element || this.$element

            var el = $element[0]
            var isBody = el.tagName == 'BODY'

            var elRect = el.getBoundingClientRect()
            if (elRect.width == null) {

                elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
            }
            var isSvg = window.SVGElement && el instanceof window.SVGElement

            var elOffset = isBody ? { top: 0, left: 0 } : (isSvg ? null : $element.offset())
            var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
            var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null

            return $.extend({}, elRect, scroll, outerDims, elOffset)
        }

        Tooltip.prototype.getCalculatedOffset = function(placement, pos, actualWidth, actualHeight) {
            return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
                placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
                placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
                /* placement == 'right' */
                { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }

        }

        Tooltip.prototype.getViewportAdjustedDelta = function(placement, pos, actualWidth, actualHeight) {
            var delta = { top: 0, left: 0 }
            if (!this.$viewport) return delta

            var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
            var viewportDimensions = this.getPosition(this.$viewport)

            if (/right|left/.test(placement)) {
                var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll
                var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
                if (topEdgeOffset < viewportDimensions.top) {
                    delta.top = viewportDimensions.top - topEdgeOffset
                } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) {
                    delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
                }
            } else {
                var leftEdgeOffset = pos.left - viewportPadding
                var rightEdgeOffset = pos.left + viewportPadding + actualWidth
                if (leftEdgeOffset < viewportDimensions.left) {
                    delta.left = viewportDimensions.left - leftEdgeOffset
                } else if (rightEdgeOffset > viewportDimensions.right) {
                    delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
                }
            }

            return delta
        }

        Tooltip.prototype.getTitle = function() {
            var title
            var $e = this.$element
            var o = this.options

            title = $e.attr('data-original-title') ||
                (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)

            return title
        }

        Tooltip.prototype.getUID = function(prefix) {
            do prefix += ~~(Math.random() * 1000000)
            while (document.getElementById(prefix))
            return prefix
        }

        Tooltip.prototype.tip = function() {
            if (!this.$tip) {
                this.$tip = $(this.options.template)
                if (this.$tip.length != 1) {
                    throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!')
                }
            }
            return this.$tip
        }

        Tooltip.prototype.arrow = function() {
            return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
        }

        Tooltip.prototype.enable = function() {
            this.enabled = true
        }

        Tooltip.prototype.disable = function() {
            this.enabled = false
        }

        Tooltip.prototype.toggleEnabled = function() {
            this.enabled = !this.enabled
        }

        Tooltip.prototype.toggle = function(e) {
            var self = this
            if (e) {
                self = $(e.currentTarget).data('bs.' + this.type)
                if (!self) {
                    self = new this.constructor(e.currentTarget, this.getDelegateOptions())
                    $(e.currentTarget).data('bs.' + this.type, self)
                }
            }

            if (e) {
                self.inState.click = !self.inState.click
                if (self.isInStateTrue()) self.enter(self)
                else self.leave(self)
            } else {
                self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
            }
        }

        Tooltip.prototype.destroy = function() {
            var that = this
            clearTimeout(this.timeout)
            this.hide(function() {
                that.$element.off('.' + that.type).removeData('bs.' + that.type)
                if (that.$tip) {
                    that.$tip.detach()
                }
                that.$tip = null
                that.$arrow = null
                that.$viewport = null
                that.$element = null
            })
        }

        function Plugin(option) {
            return this.each(function() {
                var $this = $(this)
                var data = $this.data('bs.tooltip')
                var options = typeof option == 'object' && option

                if (!data && /destroy|hide/.test(option)) return
                if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
                if (typeof option == 'string') data[option]()
            })
        }

        var old = $.fn.tooltip

        $.fn.tooltip = Plugin
        $.fn.tooltip.Constructor = Tooltip


        $.fn.tooltip.noConflict = function() {
            $.fn.tooltip = old
            return this
        }

    }(jQuery);

    /* ========================================================================
     * 弹出框 popover
     * ======================================================================== */
    +function($) {
        'use strict';

        var Popover = function(element, options) {
            this.init('popover', element, options)
        }

        if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')

        Popover.VERSION = '3.3.7'

        Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
            placement: 'right',
            trigger: 'click',
            content: '',
            template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
        })

        Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)

        Popover.prototype.constructor = Popover

        Popover.prototype.getDefaults = function() {
            return Popover.DEFAULTS
        }

        Popover.prototype.setContent = function() {
            var $tip = this.tip()
            var title = this.getTitle()
            var content = this.getContent()

            $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
            $tip.find('.popover-content').children().detach().end()[
                this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
            ](content)

            $tip.removeClass('fade top bottom left right in')

            if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
        }

        Popover.prototype.hasContent = function() {
            return this.getTitle() || this.getContent()
        }

        Popover.prototype.getContent = function() {
            var $e = this.$element
            var o = this.options

            return $e.attr('data-content') ||
                (typeof o.content == 'function' ?
                    o.content.call($e[0]) :
                    o.content)
        }

        Popover.prototype.arrow = function() {
            return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
        }

        function Plugin(option) {
            return this.each(function() {
                var $this = $(this)
                var data = $this.data('bs.popover')
                var options = typeof option == 'object' && option

                if (!data && /destroy|hide/.test(option)) return
                if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
                if (typeof option == 'string') data[option]()
            })
        }

        var old = $.fn.popover

        $.fn.popover = Plugin
        $.fn.popover.Constructor = Popover


        $.fn.popover.noConflict = function() {
            $.fn.popover = old
            return this
        }

    }(jQuery);

    /* ========================================================================
     * 警告框
     * ======================================================================== */

    +function($) {
        'use strict';

        var dismiss = '[data-dismiss="alert"]'
        var Alert = function(el) {
            $(el).on('click', dismiss, this.close)
        }

        Alert.VERSION = '3.3.7'

        Alert.TRANSITION_DURATION = 150

        Alert.prototype.close = function(e) {
            var $this = $(this)
            var selector = $this.attr('data-target')

            if (!selector) {
                selector = $this.attr('href')
                selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '')
            }

            var $parent = $(selector === '#' ? [] : selector)

            if (e) e.preventDefault()

            if (!$parent.length) {
                $parent = $this.closest('.alert')
            }

            $parent.trigger(e = $.Event('close.bs.alert'))

            if (e.isDefaultPrevented()) return

            $parent.removeClass('in')

            function removeElement() {

                $parent.detach().trigger('closed.bs.alert').remove()
            }

            $.support.transition && $parent.hasClass('fade') ?
                $parent
                .one('bsTransitionEnd', removeElement)
                .emulateTransitionEnd(Alert.TRANSITION_DURATION) :
                removeElement()
        }

        function Plugin(option) {
            return this.each(function() {
                var $this = $(this)
                var data = $this.data('bs.alert')

                if (!data) $this.data('bs.alert', (data = new Alert(this)))
                if (typeof option == 'string') data[option].call($this)
            })
        }

        var old = $.fn.alert

        $.fn.alert = Plugin
        $.fn.alert.Constructor = Alert

        $.fn.alert.noConflict = function() {
            $.fn.alert = old
            return this
        }

        $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)

    }(jQuery);

    /* ========================================================================
     * 按钮
     * ======================================================================== */
    +function($) {
        'use strict';

        var Button = function(element, options) {
            this.$element = $(element)
            this.options = $.extend({}, Button.DEFAULTS, options)
            this.isLoading = false
        }

        Button.VERSION = '3.3.7'

        Button.DEFAULTS = {
            loadingText: 'loading...'
        }

        Button.prototype.setState = function(state) {
            var d = 'disabled'
            var $el = this.$element
            var val = $el.is('input') ? 'val' : 'html'
            var data = $el.data()

            state += 'Text'

            if (data.resetText == null) $el.data('resetText', $el[val]())

            setTimeout($.proxy(function() {
                $el[val](data[state] == null ? this.options[state] : data[state])

                if (state == 'loadingText') {
                    this.isLoading = true
                    $el.addClass(d).attr(d, d).prop(d, true)
                } else if (this.isLoading) {
                    this.isLoading = false
                    $el.removeClass(d).removeAttr(d).prop(d, false)
                }
            }, this), 0)
        }

        Button.prototype.toggle = function() {
            var changed = true
            var $parent = this.$element.closest('[data-toggle="buttons"]')

            if ($parent.length) {
                var $input = this.$element.find('input')
                if ($input.prop('type') == 'radio') {
                    if ($input.prop('checked')) changed = false
                    $parent.find('.active').removeClass('active')
                    this.$element.addClass('active')
                } else if ($input.prop('type') == 'checkbox') {
                    if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false
                    this.$element.toggleClass('active')
                }
                $input.prop('checked', this.$element.hasClass('active'))
                if (changed) $input.trigger('change')
            } else {
                this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
                this.$element.toggleClass('active')
            }
        }

        function Plugin(option) {
            return this.each(function() {
                var $this = $(this)
                var data = $this.data('bs.button')
                var options = typeof option == 'object' && option

                if (!data) $this.data('bs.button', (data = new Button(this, options)))

                if (option == 'toggle') data.toggle()
                else if (option) data.setState(option)
            })
        }

        var old = $.fn.button

        $.fn.button = Plugin
        $.fn.button.Constructor = Button

        $.fn.button.noConflict = function() {
            $.fn.button = old
            return this
        }

        $(document)
            .on('click.bs.button.data-api', '[data-toggle^="button"]', function(e) {
                var $btn = $(e.target).closest('.btn')
                Plugin.call($btn, 'toggle')
                if (!($(e.target).is('input[type="radio"], input[type="checkbox"]'))) {

                    e.preventDefault()

                    if ($btn.is('input,button')) $btn.trigger('focus')
                    else $btn.find('input:visible,button:visible').first().trigger('focus')
                }
            })
            .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function(e) {
                $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
            })

    }(jQuery);

    /* ========================================================================
     * 折叠面板
     * ======================================================================== */

    +function($) {
        'use strict';

        var Collapse = function(element, options) {
            this.$element = $(element)
            this.options = $.extend({}, Collapse.DEFAULTS, options)
            this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' +
                '[data-toggle="collapse"][data-target="#' + element.id + '"]')
            this.transitioning = null

            if (this.options.parent) {
                this.$parent = this.getParent()
            } else {
                this.addAriaAndCollapsedClass(this.$element, this.$trigger)
            }

            if (this.options.toggle) this.toggle()
        }

        Collapse.VERSION = '3.3.7'

        Collapse.TRANSITION_DURATION = 350

        Collapse.DEFAULTS = {
            toggle: true
        }

        Collapse.prototype.dimension = function() {
            var hasWidth = this.$element.hasClass('width')
            return hasWidth ? 'width' : 'height'
        }

        Collapse.prototype.show = function() {
            if (this.transitioning || this.$element.hasClass('in')) return

            var activesData
            var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')

            if (actives && actives.length) {
                activesData = actives.data('bs.collapse')
                if (activesData && activesData.transitioning) return
            }

            var startEvent = $.Event('show.bs.collapse')
            this.$element.trigger(startEvent)
            if (startEvent.isDefaultPrevented()) return

            if (actives && actives.length) {
                Plugin.call(actives, 'hide')
                activesData || actives.data('bs.collapse', null)
            }

            var dimension = this.dimension()

            this.$element
                .removeClass('collapse')
                .addClass('collapsing')[dimension](0)
                .attr('aria-expanded', true)

            this.$trigger
                .removeClass('collapsed')
                .attr('aria-expanded', true)

            this.transitioning = 1

            var complete = function() {
                this.$element
                    .removeClass('collapsing')
                    .addClass('collapse in')[dimension]('')
                this.transitioning = 0
                this.$element
                    .trigger('shown.bs.collapse')
            }

            if (!$.support.transition) return complete.call(this)

            var scrollSize = $.camelCase(['scroll', dimension].join('-'))

            this.$element
                .one('bsTransitionEnd', $.proxy(complete, this))
                .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])
        }

        Collapse.prototype.hide = function() {
            if (this.transitioning || !this.$element.hasClass('in')) return

            var startEvent = $.Event('hide.bs.collapse')
            this.$element.trigger(startEvent)
            if (startEvent.isDefaultPrevented()) return

            var dimension = this.dimension()

            this.$element[dimension](this.$element[dimension]())[0].offsetHeight

            this.$element
                .addClass('collapsing')
                .removeClass('collapse in')
                .attr('aria-expanded', false)

            this.$trigger
                .addClass('collapsed')
                .attr('aria-expanded', false)

            this.transitioning = 1

            var complete = function() {
                this.transitioning = 0
                this.$element
                    .removeClass('collapsing')
                    .addClass('collapse')
                    .trigger('hidden.bs.collapse')
            }

            if (!$.support.transition) return complete.call(this)

            this.$element[dimension](0)
                .one('bsTransitionEnd', $.proxy(complete, this))
                .emulateTransitionEnd(Collapse.TRANSITION_DURATION)
        }

        Collapse.prototype.toggle = function() {
            this[this.$element.hasClass('in') ? 'hide' : 'show']()
        }

        Collapse.prototype.getParent = function() {
            return $(this.options.parent)
                .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
                .each($.proxy(function(i, element) {
                    var $element = $(element)
                    this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)
                }, this))
                .end()
        }

        Collapse.prototype.addAriaAndCollapsedClass = function($element, $trigger) {
            var isOpen = $element.hasClass('in')

            $element.attr('aria-expanded', isOpen)
            $trigger
                .toggleClass('collapsed', !isOpen)
                .attr('aria-expanded', isOpen)
        }

        function getTargetFromTrigger($trigger) {
            var href
            var target = $trigger.attr('data-target') ||
                (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7

            return $(target)
        }


        function Plugin(option) {
            return this.each(function() {
                var $this = $(this)
                var data = $this.data('bs.collapse')
                var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)

                if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false
                if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
                if (typeof option == 'string') data[option]()
            })
        }

        var old = $.fn.collapse

        $.fn.collapse = Plugin
        $.fn.collapse.Constructor = Collapse


        $.fn.collapse.noConflict = function() {
            $.fn.collapse = old
            return this
        }

        $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) {
            var $this = $(this)

            if (!$this.attr('data-target')) e.preventDefault()

            var $target = getTargetFromTrigger($this)
            var data = $target.data('bs.collapse')
            var option = data ? 'toggle' : $this.data()

            Plugin.call($target, option)
        })

    }(jQuery);



    /* ========================================================================
     * 数字输入框
     * ======================================================================== */
    +function($) {
        'use strict';

        var Tuning = function(ele, opt) {
            this.$ele = ele;
            this.defaults = {
                ele : '.input-number',
                incrementing : 1
            },
            this.options = $.extend({}, this.defaults, opt);
        }

        Tuning.VERSION = '1.0';

        Tuning.prototype.init = function() {
            this.$ele.attr('data-toggle', 'Tuning');
            var min = Number(this.options.min), 
                max = Number(this.options.max),
                element = this.$ele,
                btnClick = this.options.btnClick,
                change = this.options.change,
                incrementing = Number(this.options.incrementing),
                value = Number(this.options.value);
                if(value <= min && !isNaN(value)) value = min;
                if(value >= max && !isNaN(value)) value = max;
                if(isNaN(value)) value = 0;
                element.find('> .form-control').val(value);
                if(incrementing == 0) incrementing = 1;
               
            if(typeof(this.options.isReadonly) == 'boolean'){
                if(this.options.isReadonly == true) element.find('> .form-control').attr('readonly',true);
            }

            $(document).on('click', this.defaults.ele + ' .form-control', function(){
                $(this).parents('.input-number').find('> .form-control').bind('input propertychange', function(){
                    onChange($(this));
                });
            });

            $(document).on('click', this.defaults.ele + ' .btn-plus', function(){
                value = Number($(this).parents('.input-number').find('> .form-control').val());
                value = value + incrementing;
                if(value >= max) value = max;
                $(this).parents('.input-number').find('> .form-control').val(value);
                if(typeof(btnClick) == 'function'){
                    btnClick({
                        value : value,
                        type : 'plus'
                    });
                }
            });

            $(document).on('click', this.defaults.ele + ' .btn-reduce', function(){
                value = Number($(this).parents('.input-number').find('> .form-control').val());
                value = value - incrementing;
                if(value <= min) value = min;
                $(this).parents('.input-number').find('> .form-control').val(value);
                if(typeof(btnClick) == 'function'){
                    btnClick({
                        value : value,
                        type : 'reduce'
                    });
                }
            });

            $(document).find('.input-number').find('.form-control').bind('input propertychange', function(){
                onChange($(this));
            });
            function onChange(e){
                value = Number(e.val());
                if(value <= min) value = min;
                if(value >= max) value = max;
                e.parents('.input-number').find('> .form-control').val(value);
                if(typeof(change) == 'function'){
                    change(value);
                }
            }
        }

        $.fn.tuning = function(options) {
            var tuning = new Tuning($(this), options);
            return tuning.init();
        }

    }(jQuery);

    /* ========================================================================
     * 效果
     * ======================================================================== */
    +function($) {
        'use strict';
        var dataSpace = "ui-effects-",
            dataSpaceStyle = "ui-effects-style",
            dataSpaceAnimated = "ui-effects-animated",
            jQuery = $;
        $.effects = {
            effect: {}
        };
        (function () {
            if ($.expr && $.expr.filters && $.expr.filters.animated) {
                $.expr.filters.animated = (function (orig) {
                    return function (elem) {
                        return !!$(elem).data(dataSpaceAnimated) || orig(elem);
                    };
                })($.expr.filters.animated);
            }
            if ($.uiBackCompat !== false) {
                $.extend($.effects, {
                    save: function (element, set) {
                        var i = 0,
                            length = set.length;
                        for (; i < length; i++) {
                            if (set [i] !== null) {
                                element.data(dataSpace + set [i], element[0].style[set [i]]);
                            }
                        }
                    }, restore: function (element, set) {
                        var val, i = 0,
                            length = set.length;
                        for (; i < length; i++) {
                            if (set [i] !== null) {
                                val = element.data(dataSpace + set [i]);
                                element.css(set [i], val);
                            }
                        }
                    }, setMode: function (el, mode) {
                        if (mode === "toggle") {
                            mode = el.is(":hidden") ? "show" : "hide";
                        }
                        return mode;
                    }, createWrapper: function (element) {
                        if (element.parent().is(".ui-effects-wrapper")) {
                            return element.parent();
                        }
                        var props = {
                                width: element.outerWidth(true),
                                height: element.outerHeight(true),
                                "float": element.css("float")
                            },
                            wrapper = $("<div></div>").addClass("ui-effects-wrapper").css({
                                fontSize: "100%",
                                background: "transparent",
                                border: "none",
                                margin: 0,
                                padding: 0
                            }),
                            size = {
                                width: element.width(),
                                height: element.height()
                            },
                            active = document.activeElement;
                        try {
                            active.id;
                        } catch (e) {
                            active = document.body;
                        }
                        element.wrap(wrapper);
                        if (element[0] === active || $.contains(element[0], active)) {
                            $(active).trigger("focus");
                        }
                        wrapper = element.parent();
                        if (element.css("position") === "static") {
                            wrapper.css({
                                position: "relative"
                            });
                            element.css({
                                position: "relative"
                            });
                        } else {
                            $.extend(props, {
                                position: element.css("position"),
                                zIndex: element.css("z-index")
                            });
                            $.each(["top", "left", "bottom", "right"], function (i, pos) {
                                props[pos] = element.css(pos);
                                if (isNaN(parseInt(props[pos], 10))) {
                                    props[pos] = "auto";
                                }
                            });
                            element.css({
                                position: "relative",
                                top: 0,
                                left: 0,
                                right: "auto",
                                bottom: "auto"
                            });
                        }
                        element.css(size);
                        return wrapper.css(props).show();
                    }, removeWrapper: function (element) {
                        var active = document.activeElement;
                        if (element.parent().is(".ui-effects-wrapper")) {
                            element.parent().replaceWith(element);
                            if (element[0] === active || $.contains(element[0], active)) {
                                $(active).trigger("focus");
                            }
                        }
                        return element;
                    }
                });
            }
            $.extend($.effects, {
                version: "1.12.1",
                define: function (name, mode, effect) {
                    if (!effect) {
                        effect = mode;
                        mode = "effect";
                    }
                    $.effects.effect[name] = effect;
                    $.effects.effect[name].mode = mode;
                    return effect;
                }, scaledDimensions: function (element, percent, direction) {
                    if (percent === 0) {
                        return {
                            height: 0,
                            width: 0,
                            outerHeight: 0,
                            outerWidth: 0
                        };
                    }
                    var x = direction !== "horizontal" ? ((percent || 100) / 100) : 1,
                        y = direction !== "vertical" ? ((percent || 100) / 100) : 1;
                    return {
                        height: element.height() * y,
                        width: element.width() * x,
                        outerHeight: element.outerHeight() * y,
                        outerWidth: element.outerWidth() * x
                    };
                }, clipToBox: function (animation) {
                    return {
                        width: animation.clip.right - animation.clip.left,
                        height: animation.clip.bottom - animation.clip.top,
                        left: animation.clip.left,
                        top: animation.clip.top
                    };
                }, unshift: function (element, queueLength, count) {
                    var queue = element.queue();
                    if (queueLength > 1) {
                        queue.splice.apply(queue, [1, 0].concat(queue.splice(queueLength, count)));
                    }
                    element.dequeue();
                }, saveStyle: function (element) {
                    element.data(dataSpaceStyle, element[0].style.cssText);
                }, restoreStyle: function (element) {
                    element[0].style.cssText = element.data(dataSpaceStyle) || "";
                    element.removeData(dataSpaceStyle);
                }, mode: function (element, mode) {
                    var hidden = element.is(":hidden");
                    if (mode === "toggle") {
                        mode = hidden ? "show" : "hide";
                    }
                    if (hidden ? mode === "hide" : mode === "show") {
                        mode = "none";
                    }
                    return mode;
                }, getBaseline: function (origin, original) {
                    var y, x;
                    switch (origin[0]) {
                    case "top":
                        y = 0;
                        break;
                    case "middle":
                        y = 0.5;
                        break;
                    case "bottom":
                        y = 1;
                        break;
                    default:
                        y = origin[0] / original.height;
                    }
                    switch (origin[1]) {
                    case "left":
                        x = 0;
                        break;
                    case "center":
                        x = 0.5;
                        break;
                    case "right":
                        x = 1;
                        break;
                    default:
                        x = origin[1] / original.width;
                    }
                    return {
                        x: x,
                        y: y
                    };
                }, createPlaceholder: function (element) {
                    var placeholder, cssPosition = element.css("position"),
                        position = element.position();
                    element.css({
                        marginTop: element.css("marginTop"),
                        marginBottom: element.css("marginBottom"),
                        marginLeft: element.css("marginLeft"),
                        marginRight: element.css("marginRight")
                    }).outerWidth(element.outerWidth()).outerHeight(element.outerHeight());
                    if (/^(static|relative)/.test(cssPosition)) {
                        cssPosition = "absolute";
                        placeholder = $("<" + element[0].nodeName + ">").insertAfter(element).css({
                            display: /^(inline|ruby)/.test(element.css("display")) ? "inline-block" : "block",
                            visibility: "hidden",
                            marginTop: element.css("marginTop"),
                            marginBottom: element.css("marginBottom"),
                            marginLeft: element.css("marginLeft"),
                            marginRight: element.css("marginRight"),
                            "float": element.css("float")
                        }).outerWidth(element.outerWidth()).outerHeight(element.outerHeight()).addClass("ui-effects-placeholder");
                        element.data(dataSpace + "placeholder", placeholder);
                    }
                    element.css({
                        position: cssPosition,
                        left: position.left,
                        top: position.top
                    });
                    return placeholder;
                }, removePlaceholder: function (element) {
                    var dataKey = dataSpace + "placeholder",
                        placeholder = element.data(dataKey);
                    if (placeholder) {
                        placeholder.remove();
                        element.removeData(dataKey);
                    }
                }, cleanUp: function (element) {
                    $.effects.restoreStyle(element);
                    $.effects.removePlaceholder(element);
                }, setTransition: function (element, list, factor, value) {
                    value = value || {};
                    $.each(list, function (i, x) {
                        var unit = element.cssUnit(x);
                        if (unit[0] > 0) {
                            value[x] = unit[0] * factor + unit[1];
                        }
                    });
                    return value;
                }
            });

            function _normalizeArguments(effect, options, speed, callback) {
                if ($.isPlainObject(effect)) {
                    options = effect;
                    effect = effect.effect;
                }
                effect = {
                    effect: effect
                };
                if (options == null) {
                    options = {};
                }
                if ($.isFunction(options)) {
                    callback = options;
                    speed = null;
                    options = {};
                }
                if (typeof options === "number" || $.fx.speeds[options]) {
                    callback = speed;
                    speed = options;
                    options = {};
                }
                if ($.isFunction(speed)) {
                    callback = speed;
                    speed = null;
                }
                if (options) {
                    $.extend(effect, options);
                }
                speed = speed || options.duration;
                effect.duration = $.fx.off ? 0 : typeof speed === "number" ? speed : speed in $.fx.speeds ? $.fx.speeds[speed] : $.fx.speeds._default;
                effect.complete = callback || options.complete;
                return effect;
            }

            function standardAnimationOption(option) {
                if (!option || typeof option === "number" || $.fx.speeds[option]) {
                    return true;
                }
                if (typeof option === "string" && !$.effects.effect[option]) {
                    return true;
                }
                if ($.isFunction(option)) {
                    return true;
                }
                if (typeof option === "object" && !option.effect) {
                    return true;
                }
                return false;
            }
            $.fn.extend({
                effect: function () {

                    var args = _normalizeArguments.apply(this, arguments),
                        effectMethod = $.effects.effect[args.effect],
                        defaultMode = effectMethod.mode,
                        queue = args.queue,
                        queueName = queue || "fx",
                        complete = args.complete,
                        mode = args.mode,
                        modes = [],
                        prefilter = function (next) {
                            var el = $(this),
                                normalizedMode = $.effects.mode(el, mode) || defaultMode;
                            el.data(dataSpaceAnimated, true);
                            modes.push(normalizedMode);
                            if (defaultMode && (normalizedMode === "show" || (normalizedMode === defaultMode && normalizedMode === "hide"))) {
                                el.show();
                            }
                            if (!defaultMode || normalizedMode !== "none") {
                                $.effects.saveStyle(el);
                            }
                            if ($.isFunction(next)) {
                                next();
                            }
                        };

                    if ($.fx.off || !effectMethod) {
                        if (mode) {
                            return this[mode](args.duration, complete);
                        } else {
                            return this.each(function () {
                                if (complete) {
                                    complete.call(this);
                                }
                            });
                        }
                    }

                    function run(next) {
                        var elem = $(this);

                        function cleanup() {
                            elem.removeData(dataSpaceAnimated);
                            $.effects.cleanUp(elem);
                            if (args.mode === "hide") {
                                elem.hide();
                            }
                            done();
                        }

                        function done() {
                            if ($.isFunction(complete)) {
                                complete.call(elem[0]);
                            }
                            if ($.isFunction(next)) {
                                next();
                            }
                        }
                        args.mode = modes.shift();
                        if ($.uiBackCompat !== false && !defaultMode) {
                            if (elem.is(":hidden") ? mode === "hide" : mode === "show") {
                                elem[mode]();
                                done();
                            } else {
                                effectMethod.call(elem[0], args, done);
                            }
                        } else {
                            if (args.mode === "none") {
                                elem[mode]();
                                done();
                            } else {
                                effectMethod.call(elem[0], args, cleanup);
                            }
                        }
                    }
                    return queue === false ? this.each(prefilter).each(run) : this.queue(queueName, prefilter).queue(queueName, run);
                }, show: (function (orig) {
                    return function (option) {
                        if (standardAnimationOption(option)) {
                            return orig.apply(this, arguments);
                        } else {
                            var args = _normalizeArguments.apply(this, arguments);
                            args.mode = "show";
                            return this.effect.call(this, args);
                        }
                    };
                })($.fn.show),
                hide: (function (orig) {
                    return function (option) {
                        if (standardAnimationOption(option)) {
                            return orig.apply(this, arguments);
                        } else {
                            var args = _normalizeArguments.apply(this, arguments);
                            args.mode = "hide";
                            return this.effect.call(this, args);
                        }
                    };
                })($.fn.hide),
                toggle: (function (orig) {
                    return function (option) {
                        if (standardAnimationOption(option) || typeof option === "boolean") {
                            return orig.apply(this, arguments);
                        } else {
                            var args = _normalizeArguments.apply(this, arguments);
                            args.mode = "toggle";
                            return this.effect.call(this, args);
                        }
                    };
                })($.fn.toggle),
                cssUnit: function (key) {
                    var style = this.css(key),
                        val = [];
                    $.each(["em", "px", "%", "pt"], function (i, unit) {
                        if (style.indexOf(unit) > 0) {
                            val = [parseFloat(style), unit];
                        }
                    });
                    return val;
                }, cssClip: function (clipObj) {
                    if (clipObj) {
                        return this.css("clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " + clipObj.bottom + "px " + clipObj.left + "px)");
                    }
                    return parseClip(this.css("clip"), this);
                }
            });

            function parseClip(str, element) {
                var outerWidth = element.outerWidth(),
                    outerHeight = element.outerHeight(),
                    clipRegex = /^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/,
                    values = clipRegex.exec(str) || ["", 0, outerWidth, outerHeight, 0];
                return {
                    top: parseFloat(values[1]) || 0,
                    right: values[2] === "auto" ? outerWidth : parseFloat(values[2]),
                    bottom: values[3] === "auto" ? outerHeight : parseFloat(values[3]),
                    left: parseFloat(values[4]) || 0
                };
            }
            $.fx.step.clip = function (fx) {
                if (!fx.clipInit) {
                    fx.start = $(fx.elem).cssClip();
                    if (typeof fx.end === "string") {
                        fx.end = parseClip(fx.end, fx.elem);
                    }
                    fx.clipInit = true;
                }
                $(fx.elem).cssClip({
                    top: fx.pos * (fx.end.top - fx.start.top) + fx.start.top,
                    right: fx.pos * (fx.end.right - fx.start.right) + fx.start.right,
                    bottom: fx.pos * (fx.end.bottom - fx.start.bottom) + fx.start.bottom,
                    left: fx.pos * (fx.end.left - fx.start.left) + fx.start.left
                });
            };
        })();
        var effect = $.effects;
        var effectsEffectBlind = $.effects.define("blind", "hide", function (options, done) {
            var map = {
                    up: ["bottom", "top"],
                    vertical: ["bottom", "top"],
                    down: ["top", "bottom"],
                    left: ["right", "left"],
                    horizontal: ["right", "left"],
                    right: ["left", "right"]
                },
                element = $(this),
                direction = options.direction || "up",
                start = element.cssClip(),
                animate = {
                    clip: $.extend({}, start)
                },
                placeholder = $.effects.createPlaceholder(element);
            animate.clip[map[direction][0]] = animate.clip[map[direction][1]];
            if (options.mode === "show") {
                element.cssClip(animate.clip);
                if (placeholder) {
                    placeholder.css($.effects.clipToBox(animate));
                }
                animate.clip = start;
            }
            if (placeholder) {
                placeholder.animate($.effects.clipToBox(animate), options.duration, options.easing);
            }
            element.animate(animate, {
                queue: false,
                duration: options.duration,
                easing: options.easing,
                complete: done
            });
        });
        var effectsEffectBounce = $.effects.define("bounce", function (options, done) {
            var upAnim, downAnim, refValue, element = $(this),
                mode = options.mode,
                hide = mode === "hide",
                show = mode === "show",
                direction = options.direction || "up",
                distance = options.distance,
                times = options.times || 5,
                anims = times * 2 + (show || hide ? 1 : 0),
                speed = options.duration / anims,
                easing = options.easing,
                ref = (direction === "up" || direction === "down") ? "top" : "left",
                motion = (direction === "up" || direction === "left"),
                i = 0,
                queuelen = element.queue().length;
            $.effects.createPlaceholder(element);
            refValue = element.css(ref);
            if (!distance) {
                distance = element[ref === "top" ? "outerHeight" : "outerWidth"]() / 3;
            }
            if (show) {
                downAnim = {
                    opacity: 1
                };
                downAnim[ref] = refValue;
                element.css("opacity", 0).css(ref, motion ? -distance * 2 : distance * 2).animate(downAnim, speed, easing);
            }
            if (hide) {
                distance = distance / Math.pow(2, times - 1);
            }
            downAnim = {};
            downAnim[ref] = refValue;
            for (; i < times; i++) {
                upAnim = {};
                upAnim[ref] = (motion ? "-=" : "+=") + distance;
                element.animate(upAnim, speed, easing).animate(downAnim, speed, easing);
                distance = hide ? distance * 2 : distance / 2;
            }
            if (hide) {
                upAnim = {
                    opacity: 0
                };
                upAnim[ref] = (motion ? "-=" : "+=") + distance;
                element.animate(upAnim, speed, easing);
            }
            element.queue(done);
            $.effects.unshift(element, queuelen, anims + 1);
        });
        var effectsEffectClip = $.effects.define("clip", "hide", function (options, done) {
            var start, animate = {},
                element = $(this),
                direction = options.direction || "vertical",
                both = direction === "both",
                horizontal = both || direction === "horizontal",
                vertical = both || direction === "vertical";
            start = element.cssClip();
            animate.clip = {
                top: vertical ? (start.bottom - start.top) / 2 : start.top,
                right: horizontal ? (start.right - start.left) / 2 : start.right,
                bottom: vertical ? (start.bottom - start.top) / 2 : start.bottom,
                left: horizontal ? (start.right - start.left) / 2 : start.left
            };
            $.effects.createPlaceholder(element);
            if (options.mode === "show") {
                element.cssClip(animate.clip);
                animate.clip = start;
            }
            element.animate(animate, {
                queue: false,
                duration: options.duration,
                easing: options.easing,
                complete: done
            });
        });
        var effectsEffectDrop = $.effects.define("drop", "hide", function (options, done) {
            var distance, element = $(this),
                mode = options.mode,
                show = mode === "show",
                direction = options.direction || "left",
                ref = (direction === "up" || direction === "down") ? "top" : "left",
                motion = (direction === "up" || direction === "left") ? "-=" : "+=",
                oppositeMotion = (motion === "+=") ? "-=" : "+=",
                animation = {
                    opacity: 0
                };
            $.effects.createPlaceholder(element);
            distance = options.distance || element[ref === "top" ? "outerHeight" : "outerWidth"](true) / 2;
            animation[ref] = motion + distance;
            if (show) {
                element.css(animation);
                animation[ref] = oppositeMotion + distance;
                animation.opacity = 1;
            }
            element.animate(animation, {
                queue: false,
                duration: options.duration,
                easing: options.easing,
                complete: done
            });
        });
        var effectsEffectExplode = $.effects.define("explode", "hide", function (options, done) {
            var i, j, left, top, mx, my, rows = options.pieces ? Math.round(Math.sqrt(options.pieces)) : 3,
                cells = rows,
                element = $(this),
                mode = options.mode,
                show = mode === "show",
                offset = element.show().css("visibility", "hidden").offset(),
                width = Math.ceil(element.outerWidth() / cells),
                height = Math.ceil(element.outerHeight() / rows),
                pieces = [];

            function childComplete() {
                pieces.push(this);
                if (pieces.length === rows * cells) {
                    animComplete();
                }
            }
            for (i = 0; i < rows; i++) {
                top = offset.top + i * height;
                my = i - (rows - 1) / 2;
                for (j = 0; j < cells; j++) {
                    left = offset.left + j * width;
                    mx = j - (cells - 1) / 2;
                    element.clone().appendTo("body").wrap("<div></div>").css({
                        position: "absolute",
                        visibility: "visible",
                        left: -j * width,
                        top: -i * height
                    }).parent().addClass("ui-effects-explode").css({
                        position: "absolute",
                        overflow: "hidden",
                        width: width,
                        height: height,
                        left: left + (show ? mx * width : 0),
                        top: top + (show ? my * height : 0),
                        opacity: show ? 0 : 1
                    }).animate({
                        left: left + (show ? 0 : mx * width),
                        top: top + (show ? 0 : my * height),
                        opacity: show ? 1 : 0
                    }, options.duration || 500, options.easing, childComplete);
                }
            }

            function animComplete() {
                element.css({
                    visibility: "visible"
                });
                $(pieces).remove();
                done();
            }
        });
        var effectsEffectFade = $.effects.define("fade", "toggle", function (options, done) {
            var show = options.mode === "show";
            $(this).css("opacity", show ? 0 : 1).animate({
                opacity: show ? 1 : 0
            }, {
                queue: false,
                duration: options.duration,
                easing: options.easing,
                complete: done
            });
        });
        var effectsEffectFold = $.effects.define("fold", "hide", function (options, done) {
            var element = $(this),
                mode = options.mode,
                show = mode === "show",
                hide = mode === "hide",
                size = options.size || 15,
                percent = /([0-9]+)%/.exec(size),
                horizFirst = !!options.horizFirst,
                ref = horizFirst ? ["right", "bottom"] : ["bottom", "right"],
                duration = options.duration / 2,
                placeholder = $.effects.createPlaceholder(element),
                start = element.cssClip(),
                animation1 = {
                    clip: $.extend({}, start)
                },
                animation2 = {
                    clip: $.extend({}, start)
                },
                distance = [start[ref[0]], start[ref[1]]],
                queuelen = element.queue().length;
            if (percent) {
                size = parseInt(percent[1], 10) / 100 * distance[hide ? 0 : 1];
            }
            animation1.clip[ref[0]] = size;
            animation2.clip[ref[0]] = size;
            animation2.clip[ref[1]] = 0;
            if (show) {
                element.cssClip(animation2.clip);
                if (placeholder) {
                    placeholder.css($.effects.clipToBox(animation2));
                }
                animation2.clip = start;
            }
            element.queue(function (next) {
                if (placeholder) {
                    placeholder.animate($.effects.clipToBox(animation1), duration, options.easing).animate($.effects.clipToBox(animation2), duration, options.easing);
                }
                next();
            }).animate(animation1, duration, options.easing).animate(animation2, duration, options.easing).queue(done);
            $.effects.unshift(element, queuelen, 4);
        });
        var effectsEffectHighlight = $.effects.define("highlight", "show", function (options, done) {
            var element = $(this),
                animation = {
                    backgroundColor: element.css("backgroundColor")
                };
            if (options.mode === "hide") {
                animation.opacity = 0;
            }
            $.effects.saveStyle(element);
            element.css({
                backgroundImage: "none",
                backgroundColor: options.color || "#ffff99"
            }).animate(animation, {
                queue: false,
                duration: options.duration,
                easing: options.easing,
                complete: done
            });
        });
        var effectsEffectSize = $.effects.define("size", function (options, done) {
            var baseline, factor, temp, element = $(this),
                cProps = ["fontSize"],
                vProps = ["borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"],
                hProps = ["borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight"],
                mode = options.mode,
                restore = mode !== "effect",
                scale = options.scale || "both",
                origin = options.origin || ["middle", "center"],
                position = element.css("position"),
                pos = element.position(),
                original = $.effects.scaledDimensions(element),
                from = options.from || original,
                to = options.to || $.effects.scaledDimensions(element, 0);
            $.effects.createPlaceholder(element);
            if (mode === "show") {
                temp = from;
                from = to;
                to = temp;
            }
            factor = {
                from: {
                    y: from.height / original.height,
                    x: from.width / original.width
                },
                to: {
                    y: to.height / original.height,
                    x: to.width / original.width
                }
            };
            if (scale === "box" || scale === "both") {
                if (factor.from.y !== factor.to.y) {
                    from = $.effects.setTransition(element, vProps, factor.from.y, from);
                    to = $.effects.setTransition(element, vProps, factor.to.y, to);
                }
                if (factor.from.x !== factor.to.x) {
                    from = $.effects.setTransition(element, hProps, factor.from.x, from);
                    to = $.effects.setTransition(element, hProps, factor.to.x, to);
                }
            }
            if (scale === "content" || scale === "both") {
                if (factor.from.y !== factor.to.y) {
                    from = $.effects.setTransition(element, cProps, factor.from.y, from);
                    to = $.effects.setTransition(element, cProps, factor.to.y, to);
                }
            }
            if (origin) {
                baseline = $.effects.getBaseline(origin, original);
                from.top = (original.outerHeight - from.outerHeight) * baseline.y + pos.top;
                from.left = (original.outerWidth - from.outerWidth) * baseline.x + pos.left;
                to.top = (original.outerHeight - to.outerHeight) * baseline.y + pos.top;
                to.left = (original.outerWidth - to.outerWidth) * baseline.x + pos.left;
            }
            element.css(from);
            if (scale === "content" || scale === "both") {
                vProps = vProps.concat(["marginTop", "marginBottom"]).concat(cProps);
                hProps = hProps.concat(["marginLeft", "marginRight"]);
                element.find("*[width]").each(function () {
                    var child = $(this),
                        childOriginal = $.effects.scaledDimensions(child),
                        childFrom = {
                            height: childOriginal.height * factor.from.y,
                            width: childOriginal.width * factor.from.x,
                            outerHeight: childOriginal.outerHeight * factor.from.y,
                            outerWidth: childOriginal.outerWidth * factor.from.x
                        },
                        childTo = {
                            height: childOriginal.height * factor.to.y,
                            width: childOriginal.width * factor.to.x,
                            outerHeight: childOriginal.height * factor.to.y,
                            outerWidth: childOriginal.width * factor.to.x
                        };
                    if (factor.from.y !== factor.to.y) {
                        childFrom = $.effects.setTransition(child, vProps, factor.from.y, childFrom);
                        childTo = $.effects.setTransition(child, vProps, factor.to.y, childTo);
                    }
                    if (factor.from.x !== factor.to.x) {
                        childFrom = $.effects.setTransition(child, hProps, factor.from.x, childFrom);
                        childTo = $.effects.setTransition(child, hProps, factor.to.x, childTo);
                    }
                    if (restore) {
                        $.effects.saveStyle(child);
                    }
                    child.css(childFrom);
                    child.animate(childTo, options.duration, options.easing, function () {
                        if (restore) {
                            $.effects.restoreStyle(child);
                        }
                    });
                });
            }
            element.animate(to, {
                queue: false,
                duration: options.duration,
                easing: options.easing,
                complete: function () {
                    var offset = element.offset();
                    if (to.opacity === 0) {
                        element.css("opacity", from.opacity);
                    }
                    if (!restore) {
                        element.css("position", position === "static" ? "relative" : position).offset(offset);
                        $.effects.saveStyle(element);
                    }
                    done();
                }
            });
        });
        var effectsEffectScale = $.effects.define("scale", function (options, done) {
            var el = $(this),
                mode = options.mode,
                percent = parseInt(options.percent, 10) || (parseInt(options.percent, 10) === 0 ? 0 : (mode !== "effect" ? 0 : 100)),
                newOptions = $.extend(true, {
                    from: $.effects.scaledDimensions(el),
                    to: $.effects.scaledDimensions(el, percent, options.direction || "both"),
                    origin: options.origin || ["middle", "center"]
                }, options);
            if (options.fade) {
                newOptions.from.opacity = 1;
                newOptions.to.opacity = 0;
            }
            $.effects.effect.size.call(this, newOptions, done);
        });
        var effectsEffectPuff = $.effects.define("puff", "hide", function (options, done) {
            var newOptions = $.extend(true, {}, options, {
                fade: true,
                percent: parseInt(options.percent, 10) || 150
            });
            $.effects.effect.scale.call(this, newOptions, done);
        });
        var effectsEffectPulsate = $.effects.define("pulsate", "show", function (options, done) {
            var element = $(this),
                mode = options.mode,
                show = mode === "show",
                hide = mode === "hide",
                showhide = show || hide,
                anims = ((options.times || 5) * 2) + (showhide ? 1 : 0),
                duration = options.duration / anims,
                animateTo = 0,
                i = 1,
                queuelen = element.queue().length;
            if (show || !element.is(":visible")) {
                element.css("opacity", 0).show();
                animateTo = 1;
            }
            for (; i < anims; i++) {
                element.animate({
                    opacity: animateTo
                }, duration, options.easing);
                animateTo = 1 - animateTo;
            }
            element.animate({
                opacity: animateTo
            }, duration, options.easing);
            element.queue(done);
            $.effects.unshift(element, queuelen, anims + 1);
        });
        var effectsEffectShake = $.effects.define("shake", function (options, done) {
            var i = 1,
                element = $(this),
                direction = options.direction || "left",
                distance = options.distance || 20,
                times = options.times || 3,
                anims = times * 2 + 1,
                speed = Math.round(options.duration / anims),
                ref = (direction === "up" || direction === "down") ? "top" : "left",
                positiveMotion = (direction === "up" || direction === "left"),
                animation = {},
                animation1 = {},
                animation2 = {},
                queuelen = element.queue().length;
            $.effects.createPlaceholder(element);
            animation[ref] = (positiveMotion ? "-=" : "+=") + distance;
            animation1[ref] = (positiveMotion ? "+=" : "-=") + distance * 2;
            animation2[ref] = (positiveMotion ? "-=" : "+=") + distance * 2;
            element.animate(animation, speed, options.easing);
            for (; i < times; i++) {
                element.animate(animation1, speed, options.easing).animate(animation2, speed, options.easing);
            }
            element.animate(animation1, speed, options.easing).animate(animation, speed / 2, options.easing).queue(done);
            $.effects.unshift(element, queuelen, anims + 1);
        });
        var effectsEffectSlide = $.effects.define("slide", "show", function (options, done) {
            var startClip, startRef, element = $(this),
                map = {
                    up: ["bottom", "top"],
                    down: ["top", "bottom"],
                    left: ["right", "left"],
                    right: ["left", "right"]
                },
                mode = options.mode,
                direction = options.direction || "left",
                ref = (direction === "up" || direction === "down") ? "top" : "left",
                positiveMotion = (direction === "up" || direction === "left"),
                distance = options.distance || element[ref === "top" ? "outerHeight" : "outerWidth"](true),
                animation = {};
            $.effects.createPlaceholder(element);
            startClip = element.cssClip();
            startRef = element.position()[ref];
            animation[ref] = (positiveMotion ? -1 : 1) * distance + startRef;
            animation.clip = element.cssClip();
            animation.clip[map[direction][1]] = animation.clip[map[direction][0]];
            if (mode === "show") {
                element.cssClip(animation.clip);
                element.css(ref, animation[ref]);
                animation.clip = startClip;
                animation[ref] = startRef;
            }
            element.animate(animation, {
                queue: false,
                duration: options.duration,
                easing: options.easing,
                complete: done
            });
        });
    }(jQuery);

    /* ========================================================================
     * 交互
     * ======================================================================== */
    +function($) {
        'use strict';
        $.ui = $.ui || {};
        var version = $.ui.version = "1.12.1";
        var widgetUuid = 0;
        var widgetSlice = Array.prototype.slice;
        $.cleanData = function(orig) {
            return function(elems) {
                var events, elem, i;
                for (i = 0;
                    (elem = elems[i]) != null; i++) { try { events = $._data(elem, "events"); if (events && events.remove) { $(elem).triggerHandler("remove") } } catch (e) {} } orig(elems)
            }
        }($.cleanData);
        $.widget = function(name, base, prototype) {
            var existingConstructor, constructor, basePrototype;
            var proxiedPrototype = {};
            var namespace = name.split(".")[0];
            name = name.split(".")[1];
            var fullName = namespace + "-" + name;
            if (!prototype) {
                prototype = base;
                base = $.Widget
            }
            if ($.isArray(prototype)) { prototype = $.extend.apply(null, [{}].concat(prototype)) } $.expr[":"][fullName.toLowerCase()] = function(elem) { return !!$.data(elem, fullName) };
            $[namespace] = $[namespace] || {};
            existingConstructor = $[namespace][name];
            constructor = $[namespace][name] = function(options, element) { if (!this._createWidget) { return new constructor(options, element) } if (arguments.length) { this._createWidget(options, element) } };
            $.extend(constructor, existingConstructor, { version: prototype.version, _proto: $.extend({}, prototype), _childConstructors: [] });
            basePrototype = new base();
            basePrototype.options = $.widget.extend({}, basePrototype.options);
            $.each(prototype, function(prop, value) {
                if (!$.isFunction(value)) { proxiedPrototype[prop] = value; return } proxiedPrototype[prop] = function() {
                    function _super() { return base.prototype[prop].apply(this, arguments) }

                    function _superApply(args) { return base.prototype[prop].apply(this, args) }
                    return function() {
                        var __super = this._super;
                        var __superApply = this._superApply;
                        var returnValue;
                        this._super = _super;
                        this._superApply = _superApply;
                        returnValue = value.apply(this, arguments);
                        this._super = __super;
                        this._superApply = __superApply;
                        return returnValue
                    }
                }()
            });
            constructor.prototype = $.widget.extend(basePrototype, { widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix || name : name }, proxiedPrototype, { constructor: constructor, namespace: namespace, widgetName: name, widgetFullName: fullName });
            if (existingConstructor) {
                $.each(existingConstructor._childConstructors, function(i, child) {
                    var childPrototype = child.prototype;
                    $.widget(childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto)
                });
                delete existingConstructor._childConstructors
            } else { base._childConstructors.push(constructor) } $.widget.bridge(name, constructor);
            return constructor
        };
        $.widget.extend = function(target) { var input = widgetSlice.call(arguments, 1); var inputIndex = 0; var inputLength = input.length; var key; var value; for (; inputIndex < inputLength; inputIndex++) { for (key in input[inputIndex]) { value = input[inputIndex][key]; if (input[inputIndex].hasOwnProperty(key) && value !== undefined) { if ($.isPlainObject(value)) { target[key] = $.isPlainObject(target[key]) ? $.widget.extend({}, target[key], value) : $.widget.extend({}, value) } else { target[key] = value } } } } return target };
        $.widget.bridge = function(name, object) {
            var fullName = object.prototype.widgetFullName || name;
            $.fn[name] = function(options) { var isMethodCall = typeof options === "string"; var args = widgetSlice.call(arguments, 1); var returnValue = this; if (isMethodCall) { if (!this.length && options === "instance") { returnValue = undefined } else { this.each(function() { var methodValue; var instance = $.data(this, fullName); if (options === "instance") { returnValue = instance; return false } if (!instance) { return $.error("cannot call methods on " + name + " prior to initialization; " + "attempted to call method '" + options + "'") } if (!$.isFunction(instance[options]) || options.charAt(0) === "_") { return $.error("no such method '" + options + "' for " + name + " widget instance") } methodValue = instance[options].apply(instance, args); if (methodValue !== instance && methodValue !== undefined) { returnValue = methodValue && methodValue.jquery ? returnValue.pushStack(methodValue.get()) : methodValue; return false } }) } } else { if (args.length) { options = $.widget.extend.apply(null, [options].concat(args)) } this.each(function() { var instance = $.data(this, fullName); if (instance) { instance.option(options || {}); if (instance._init) { instance._init() } } else { $.data(this, fullName, new object(options, this)) } }) } return returnValue }
        };
        $.Widget = function() {};
        $.Widget._childConstructors = [];
        $.Widget.prototype = {
            widgetName: "widget",
            widgetEventPrefix: "",
            defaultElement: "<div>",
            options: { classes: {}, disabled: false, create: null },
            _createWidget: function(options, element) {
                element = $(element || this.defaultElement || this)[0];
                this.element = $(element);
                this.uuid = widgetUuid++;
                this.eventNamespace = "." + this.widgetName + this.uuid;
                this.bindings = $();
                this.hoverable = $();
                this.focusable = $();
                this.classesElementLookup = {};
                if (element !== this) {
                    $.data(element, this.widgetFullName, this);
                    this._on(true, this.element, { remove: function(event) { if (event.target === element) { this.destroy() } } });
                    this.document = $(element.style ? element.ownerDocument : element.document || element);
                    this.window = $(this.document[0].defaultView || this.document[0].parentWindow)
                }
                this.options = $.widget.extend({}, this.options, this._getCreateOptions(), options);
                this._create();
                if (this.options.disabled) { this._setOptionDisabled(this.options.disabled) } this._trigger("create", null, this._getCreateEventData());
                this._init()
            },
            _getCreateOptions: function() { return {} },
            _getCreateEventData: $.noop,
            _create: $.noop,
            _init: $.noop,
            destroy: function() {
                var that = this;
                this._destroy();
                $.each(this.classesElementLookup, function(key, value) { that._removeClass(value, key) });
                this.element.off(this.eventNamespace).removeData(this.widgetFullName);
                this.widget().off(this.eventNamespace).removeAttr("aria-disabled");
                this.bindings.off(this.eventNamespace)
            },
            _destroy: $.noop,
            widget: function() { return this.element },
            option: function(key, value) {
                var options = key;
                var parts;
                var curOption;
                var i;
                if (arguments.length === 0) { return $.widget.extend({}, this.options) }
                if (typeof key === "string") {
                    options = {};
                    parts = key.split(".");
                    key = parts.shift();
                    if (parts.length) {
                        curOption = options[key] = $.widget.extend({}, this.options[key]);
                        for (i = 0; i < parts.length - 1; i++) {
                            curOption[parts[i]] = curOption[parts[i]] || {};
                            curOption = curOption[parts[i]]
                        }
                        key = parts.pop();
                        if (arguments.length === 1) { return curOption[key] === undefined ? null : curOption[key] } curOption[key] = value
                    } else { if (arguments.length === 1) { return this.options[key] === undefined ? null : this.options[key] } options[key] = value }
                }
                this._setOptions(options);
                return this
            },
            _setOptions: function(options) { var key; for (key in options) { this._setOption(key, options[key]) } return this },
            _setOption: function(key, value) { if (key === "classes") { this._setOptionClasses(value) } this.options[key] = value; if (key === "disabled") { this._setOptionDisabled(value) } return this },
            _setOptionClasses: function(value) {
                var classKey, elements, currentElements;
                for (classKey in value) {
                    currentElements = this.classesElementLookup[classKey];
                    if (value[classKey] === this.options.classes[classKey] || !currentElements || !currentElements.length) { continue } elements = $(currentElements.get());
                    this._removeClass(currentElements, classKey);
                    elements.addClass(this._classes({ element: elements, keys: classKey, classes: value, add: true }))
                }
            },
            _setOptionDisabled: function(value) {
                this._toggleClass(this.widget(), this.widgetFullName + "-disabled", null, !!value);
                if (value) {
                    this._removeClass(this.hoverable, null, "ui-state-hover");
                    this._removeClass(this.focusable, null, "ui-state-focus")
                }
            },
            enable: function() { return this._setOptions({ disabled: false }) },
            disable: function() { return this._setOptions({ disabled: true }) },
            _classes: function(options) {
                var full = [];
                var that = this;
                options = $.extend({ element: this.element, classes: this.options.classes || {} }, options);

                function processClassString(classes, checkOption) {
                    var current, i;
                    for (i = 0; i < classes.length; i++) {
                        current = that.classesElementLookup[classes[i]] || $();
                        if (options.add) { current = $($.unique(current.get().concat(options.element.get()))) } else { current = $(current.not(options.element).get()) } that.classesElementLookup[classes[i]] = current;
                        full.push(classes[i]);
                        if (checkOption && options.classes[classes[i]]) { full.push(options.classes[classes[i]]) }
                    }
                }
                this._on(options.element, { remove: "_untrackClassesElement" });
                if (options.keys) { processClassString(options.keys.match(/\S+/g) || [], true) }
                if (options.extra) { processClassString(options.extra.match(/\S+/g) || []) }
                return full.join(" ")
            },
            _untrackClassesElement: function(event) {
                var that = this;
                $.each(that.classesElementLookup, function(key, value) { if ($.inArray(event.target, value) !== -1) { that.classesElementLookup[key] = $(value.not(event.target).get()) } })
            },
            _removeClass: function(element, keys, extra) { return this._toggleClass(element, keys, extra, false) },
            _addClass: function(element, keys, extra) { return this._toggleClass(element, keys, extra, true) },
            _toggleClass: function(element, keys, extra, add) {
                add = typeof add === "boolean" ? add : extra;
                var shift = typeof element === "string" || element === null,
                    options = { extra: shift ? keys : extra, keys: shift ? element : keys, element: shift ? this.element : element, add: add };
                options.element.toggleClass(this._classes(options), add);
                return this
            },
            _on: function(suppressDisabledCheck, element, handlers) {
                var delegateElement;
                var instance = this;
                if (typeof suppressDisabledCheck !== "boolean") {
                    handlers = element;
                    element = suppressDisabledCheck;
                    suppressDisabledCheck = false
                }
                if (!handlers) {
                    handlers = element;
                    element = this.element;
                    delegateElement = this.widget()
                } else {
                    element = delegateElement = $(element);
                    this.bindings = this.bindings.add(element)
                }
                $.each(handlers, function(event, handler) {
                    function handlerProxy() { if (!suppressDisabledCheck && (instance.options.disabled === true || $(this).hasClass("ui-state-disabled"))) { return } return (typeof handler === "string" ? instance[handler] : handler).apply(instance, arguments) }
                    if (typeof handler !== "string") { handlerProxy.guid = handler.guid = handler.guid || handlerProxy.guid || $.guid++ }
                    var match = event.match(/^([\w:-]*)\s*(.*)$/);
                    var eventName = match[1] + instance.eventNamespace;
                    var selector = match[2];
                    if (selector) { delegateElement.on(eventName, selector, handlerProxy) } else { element.on(eventName, handlerProxy) }
                })
            },
            _off: function(element, eventName) {
                eventName = (eventName || "").split(" ").join(this.eventNamespace + " ") + this.eventNamespace;
                element.off(eventName).off(eventName);
                this.bindings = $(this.bindings.not(element).get());
                this.focusable = $(this.focusable.not(element).get());
                this.hoverable = $(this.hoverable.not(element).get())
            },
            _delay: function(handler, delay) {
                function handlerProxy() { return (typeof handler === "string" ? instance[handler] : handler).apply(instance, arguments) }
                var instance = this;
                return setTimeout(handlerProxy, delay || 0)
            },
            _hoverable: function(element) {
                this.hoverable = this.hoverable.add(element);
                this._on(element, { mouseenter: function(event) { this._addClass($(event.currentTarget), null, "ui-state-hover") }, mouseleave: function(event) { this._removeClass($(event.currentTarget), null, "ui-state-hover") } })
            },
            _focusable: function(element) {
                this.focusable = this.focusable.add(element);
                this._on(element, { focusin: function(event) { this._addClass($(event.currentTarget), null, "ui-state-focus") }, focusout: function(event) { this._removeClass($(event.currentTarget), null, "ui-state-focus") } })
            },
            _trigger: function(type, event, data) {
                var prop, orig;
                var callback = this.options[type];
                data = data || {};
                event = $.Event(event);
                event.type = (type === this.widgetEventPrefix ? type : this.widgetEventPrefix + type).toLowerCase();
                event.target = this.element[0];
                orig = event.originalEvent;
                if (orig) { for (prop in orig) { if (!(prop in event)) { event[prop] = orig[prop] } } } this.element.trigger(event, data);
                return !($.isFunction(callback) && callback.apply(this.element[0], [event].concat(data)) === false || event.isDefaultPrevented())
            }
        };
        $.each({ show: "fadeIn", hide: "fadeOut" }, function(method, defaultEffect) {
            $.Widget.prototype["_" + method] = function(element, options, callback) {
                if (typeof options === "string") { options = { effect: options } }
                var hasOptions;
                var effectName = !options ? method : options === true || typeof options === "number" ? defaultEffect : options.effect || defaultEffect;
                options = options || {};
                if (typeof options === "number") { options = { duration: options } } hasOptions = !$.isEmptyObject(options);
                options.complete = callback;
                if (options.delay) { element.delay(options.delay) }
                if (hasOptions && $.effects && $.effects.effect[effectName]) { element[method](options) } else if (effectName !== method && element[effectName]) { element[effectName](options.duration, options.easing, callback) } else { element.queue(function(next) { $(this)[method](); if (callback) { callback.call(element[0]) } next() }) }
            }
        });
        var widget = $.widget;
        var data = $.extend($.expr[":"], { data: $.expr.createPseudo ? $.expr.createPseudo(function(dataName) { return function(elem) { return !!$.data(elem, dataName) } }) : function(elem, i, match) { return !!$.data(elem, match[3]) } });
        var disableSelection = $.fn.extend({ disableSelection: function() { var eventType = "onselectstart" in document.createElement("div") ? "selectstart" : "mousedown"; return function() { return this.on(eventType + ".ui-disableSelection", function(event) { event.preventDefault() }) } }(), enableSelection: function() { return this.off(".ui-disableSelection") } });
        var scrollParent = $.fn.scrollParent = function(includeHidden) {
            var position = this.css("position"),
                excludeStaticParent = position === "absolute",
                overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
                scrollParent = this.parents().filter(function() { var parent = $(this); if (excludeStaticParent && parent.css("position") === "static") { return false } return overflowRegex.test(parent.css("overflow") + parent.css("overflow-y") + parent.css("overflow-x")) }).eq(0);
            return position === "fixed" || !scrollParent.length ? $(this[0].ownerDocument || document) : scrollParent
        };
        var ie = $.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());
        var mouseHandled = false;
        $(document).on("mouseup", function() { mouseHandled = false });
        var widgetsMouse = $.widget("ui.mouse", {
            version: "1.12.1",
            options: { cancel: "input, textarea, button, select, option", distance: 1, delay: 0 },
            _mouseInit: function() {
                var that = this;
                this.element.on("mousedown." + this.widgetName, function(event) { return that._mouseDown(event) }).on("click." + this.widgetName, function(event) {
                    if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
                        $.removeData(event.target, that.widgetName + ".preventClickEvent");
                        event.stopImmediatePropagation();
                        return false
                    }
                });
                this.started = false
            },
            _mouseDestroy: function() { this.element.off("." + this.widgetName); if (this._mouseMoveDelegate) { this.document.off("mousemove." + this.widgetName, this._mouseMoveDelegate).off("mouseup." + this.widgetName, this._mouseUpDelegate) } },
            _mouseDown: function(event) {
                if (mouseHandled) { return } this._mouseMoved = false;
                this._mouseStarted && this._mouseUp(event);
                this._mouseDownEvent = event;
                var that = this,
                    btnIsLeft = event.which === 1,
                    elIsCancel = typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false;
                if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { return true } this.mouseDelayMet = !this.options.delay;
                if (!this.mouseDelayMet) { this._mouseDelayTimer = setTimeout(function() { that.mouseDelayMet = true }, this.options.delay) }
                if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { this._mouseStarted = this._mouseStart(event) !== false; if (!this._mouseStarted) { event.preventDefault(); return true } }
                if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) { $.removeData(event.target, this.widgetName + ".preventClickEvent") } this._mouseMoveDelegate = function(event) { return that._mouseMove(event) };
                this._mouseUpDelegate = function(event) { return that._mouseUp(event) };
                this.document.on("mousemove." + this.widgetName, this._mouseMoveDelegate).on("mouseup." + this.widgetName, this._mouseUpDelegate);
                event.preventDefault();
                mouseHandled = true;
                return true
            },
            _mouseMove: function(event) {
                if (this._mouseMoved) { if ($.ui.ie && (!document.documentMode || document.documentMode < 9) && !event.button) { return this._mouseUp(event) } else if (!event.which) { if (event.originalEvent.altKey || event.originalEvent.ctrlKey || event.originalEvent.metaKey || event.originalEvent.shiftKey) { this.ignoreMissingWhich = true } else if (!this.ignoreMissingWhich) { return this._mouseUp(event) } } }
                if (event.which || event.button) { this._mouseMoved = true }
                if (this._mouseStarted) { this._mouseDrag(event); return event.preventDefault() }
                if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
                    this._mouseStarted = this._mouseStart(this._mouseDownEvent, event) !== false;
                    this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event)
                }
                return !this._mouseStarted
            },
            _mouseUp: function(event) {
                this.document.off("mousemove." + this.widgetName, this._mouseMoveDelegate).off("mouseup." + this.widgetName, this._mouseUpDelegate);
                if (this._mouseStarted) { this._mouseStarted = false; if (event.target === this._mouseDownEvent.target) { $.data(event.target, this.widgetName + ".preventClickEvent", true) } this._mouseStop(event) }
                if (this._mouseDelayTimer) {
                    clearTimeout(this._mouseDelayTimer);
                    delete this._mouseDelayTimer
                }
                this.ignoreMissingWhich = false;
                mouseHandled = false;
                event.preventDefault()
            },
            _mouseDistanceMet: function(event) { return Math.max(Math.abs(this._mouseDownEvent.pageX - event.pageX), Math.abs(this._mouseDownEvent.pageY - event.pageY)) >= this.options.distance },
            _mouseDelayMet: function() { return this.mouseDelayMet },
            _mouseStart: function() {},
            _mouseDrag: function() {},
            _mouseStop: function() {},
            _mouseCapture: function() { return true }
        });
        var plugin = $.ui.plugin = {
            add: function(module, option, set) {
                var i, proto = $.ui[module].prototype;
                for (i in set) {
                    proto.plugins[i] = proto.plugins[i] || [];
                    proto.plugins[i].push([option, set[i]])
                }
            },
            call: function(instance, name, args, allowDisconnected) { var i, set = instance.plugins[name]; if (!set) { return } if (!allowDisconnected && (!instance.element[0].parentNode || instance.element[0].parentNode.nodeType === 11)) { return } for (i = 0; i < set.length; i++) { if (instance.options[set[i][0]]) { set[i][1].apply(instance.element, args) } } }
        };
        var safeActiveElement = $.ui.safeActiveElement = function(document) { var activeElement; try { activeElement = document.activeElement } catch (error) { activeElement = document.body } if (!activeElement) { activeElement = document.body } if (!activeElement.nodeName) { activeElement = document.body } return activeElement };
        var safeBlur = $.ui.safeBlur = function(element) { if (element && element.nodeName.toLowerCase() !== "body") { $(element).trigger("blur") } };
        
        /*拖动*/
        $.widget("ui.draggable", $.ui.mouse, {
            version: "1.12.1",
            widgetEventPrefix: "drag",
            options: { addClasses: true, appendTo: "parent", axis: false, connectToSortable: false, containment: false, cursor: "auto", cursorAt: false, grid: false, handle: false, helper: "original", iframeFix: false, opacity: false, refreshPositions: false, revert: false, revertDuration: 500, scope: "default", scroll: true, scrollSensitivity: 20, scrollSpeed: 20, snap: false, snapMode: "both", snapTolerance: 20, stack: false, zIndex: false, drag: null, start: null, stop: null },
            _create: function() {
                if (this.options.helper === "original") { this._setPositionRelative() }
                if (this.options.addClasses) { this._addClass("ui-draggable") } this._setHandleClassName();
                this._mouseInit()
            },
            _setOption: function(key, value) {
                this._super(key, value);
                if (key === "handle") {
                    this._removeHandleClassName();
                    this._setHandleClassName()
                }
            },
            _destroy: function() {
                if ((this.helper || this.element).is(".ui-draggable-dragging")) { this.destroyOnClear = true; return } this._removeHandleClassName();
                this._mouseDestroy()
            },
            _mouseCapture: function(event) {
                var o = this.options;
                if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) { return false } this.handle = this._getHandle(event);
                if (!this.handle) { return false } this._blurActiveElement(event);
                this._blockFrames(o.iframeFix === true ? "iframe" : o.iframeFix);
                return true
            },
            _blockFrames: function(selector) { this.iframeBlocks = this.document.find(selector).map(function() { var iframe = $(this); return $("<div>").css("position", "absolute").appendTo(iframe.parent()).outerWidth(iframe.outerWidth()).outerHeight(iframe.outerHeight()).offset(iframe.offset())[0] }) },
            _unblockFrames: function() {
                if (this.iframeBlocks) {
                    this.iframeBlocks.remove();
                    delete this.iframeBlocks
                }
            },
            _blurActiveElement: function(event) {
                var activeElement = $.ui.safeActiveElement(this.document[0]),
                    target = $(event.target);
                if (target.closest(activeElement).length) { return } $.ui.safeBlur(activeElement)
            },
            _mouseStart: function(event) {
                var o = this.options;
                this.helper = this._createHelper(event);
                this._addClass(this.helper, "ui-draggable-dragging");
                this._cacheHelperProportions();
                if ($.ui.ddmanager) { $.ui.ddmanager.current = this } this._cacheMargins();
                this.cssPosition = this.helper.css("position");
                this.scrollParent = this.helper.scrollParent(true);
                this.offsetParent = this.helper.offsetParent();
                this.hasFixedAncestor = this.helper.parents().filter(function() { return $(this).css("position") === "fixed" }).length > 0;
                this.positionAbs = this.element.offset();
                this._refreshOffsets(event);
                this.originalPosition = this.position = this._generatePosition(event, false);
                this.originalPageX = event.pageX;
                this.originalPageY = event.pageY;
                o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt);
                this._setContainment();
                if (this._trigger("start", event) === false) { this._clear(); return false } this._cacheHelperProportions();
                if ($.ui.ddmanager && !o.dropBehaviour) { $.ui.ddmanager.prepareOffsets(this, event) } this._mouseDrag(event, true);
                if ($.ui.ddmanager) { $.ui.ddmanager.dragStart(this, event) }
                return true
            },
            _refreshOffsets: function(event) {
                this.offset = { top: this.positionAbs.top - this.margins.top, left: this.positionAbs.left - this.margins.left, scroll: false, parent: this._getParentOffset(), relative: this._getRelativeOffset() };
                this.offset.click = { left: event.pageX - this.offset.left, top: event.pageY - this.offset.top }
            },
            _mouseDrag: function(event, noPropagation) {
                if (this.hasFixedAncestor) { this.offset.parent = this._getParentOffset() } this.position = this._generatePosition(event, true);
                this.positionAbs = this._convertPositionTo("absolute");
                if (!noPropagation) { var ui = this._uiHash(); if (this._trigger("drag", event, ui) === false) { this._mouseUp(new $.Event("mouseup", event)); return false } this.position = ui.position } this.helper[0].style.left = this.position.left + "px";
                this.helper[0].style.top = this.position.top + "px";
                if ($.ui.ddmanager) { $.ui.ddmanager.drag(this, event) }
                return false
            },
            _mouseStop: function(event) {
                var that = this,
                    dropped = false;
                if ($.ui.ddmanager && !this.options.dropBehaviour) { dropped = $.ui.ddmanager.drop(this, event) }
                if (this.dropped) {
                    dropped = this.dropped;
                    this.dropped = false
                }
                if (this.options.revert === "invalid" && !dropped || this.options.revert === "valid" && dropped || this.options.revert === true || $.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped)) { $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() { if (that._trigger("stop", event) !== false) { that._clear() } }) } else { if (this._trigger("stop", event) !== false) { this._clear() } }
                return false
            },
            _mouseUp: function(event) { this._unblockFrames(); if ($.ui.ddmanager) { $.ui.ddmanager.dragStop(this, event) } if (this.handleElement.is(event.target)) { this.element.trigger("focus") } return $.ui.mouse.prototype._mouseUp.call(this, event) },
            cancel: function() { if (this.helper.is(".ui-draggable-dragging")) { this._mouseUp(new $.Event("mouseup", { target: this.element[0] })) } else { this._clear() } return this },
            _getHandle: function(event) { return this.options.handle ? !!$(event.target).closest(this.element.find(this.options.handle)).length : true },
            _setHandleClassName: function() {
                this.handleElement = this.options.handle ? this.element.find(this.options.handle) : this.element;
                this._addClass(this.handleElement, "ui-draggable-handle")
            },
            _removeHandleClassName: function() { this._removeClass(this.handleElement, "ui-draggable-handle") },
            _createHelper: function(event) {
                var o = this.options,
                    helperIsFunction = $.isFunction(o.helper),
                    helper = helperIsFunction ? $(o.helper.apply(this.element[0], [event])) : o.helper === "clone" ? this.element.clone().removeAttr("id") : this.element;
                if (!helper.parents("body").length) { helper.appendTo(o.appendTo === "parent" ? this.element[0].parentNode : o.appendTo) }
                if (helperIsFunction && helper[0] === this.element[0]) { this._setPositionRelative() }
                if (helper[0] !== this.element[0] && !/(fixed|absolute)/.test(helper.css("position"))) { helper.css("position", "absolute") }
                return helper
            },
            _setPositionRelative: function() { if (!/^(?:r|a|f)/.test(this.element.css("position"))) { this.element[0].style.position = "relative" } },
            _adjustOffsetFromHelper: function(obj) { if (typeof obj === "string") { obj = obj.split(" ") } if ($.isArray(obj)) { obj = { left: +obj[0], top: +obj[1] || 0 } } if ("left" in obj) { this.offset.click.left = obj.left + this.margins.left } if ("right" in obj) { this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left } if ("top" in obj) { this.offset.click.top = obj.top + this.margins.top } if ("bottom" in obj) { this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top } },
            _isRootNode: function(element) { return /(html|body)/i.test(element.tagName) || element === this.document[0] },
            _getParentOffset: function() {
                var po = this.offsetParent.offset(),
                    document = this.document[0];
                if (this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
                    po.left += this.scrollParent.scrollLeft();
                    po.top += this.scrollParent.scrollTop()
                }
                if (this._isRootNode(this.offsetParent[0])) { po = { top: 0, left: 0 } }
                return { top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0) }
            },
            _getRelativeOffset: function() {
                if (this.cssPosition !== "relative") { return { top: 0, left: 0 } }
                var p = this.element.position(),
                    scrollIsRootNode = this._isRootNode(this.scrollParent[0]);
                return { top: p.top - (parseInt(this.helper.css("top"), 10) || 0) + (!scrollIsRootNode ? this.scrollParent.scrollTop() : 0), left: p.left - (parseInt(this.helper.css("left"), 10) || 0) + (!scrollIsRootNode ? this.scrollParent.scrollLeft() : 0) }
            },
            _cacheMargins: function() { this.margins = { left: parseInt(this.element.css("marginLeft"), 10) || 0, top: parseInt(this.element.css("marginTop"), 10) || 0, right: parseInt(this.element.css("marginRight"), 10) || 0, bottom: parseInt(this.element.css("marginBottom"), 10) || 0 } },
            _cacheHelperProportions: function() { this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() } },
            _setContainment: function() {
                var isUserScrollable, c, ce, o = this.options,
                    document = this.document[0];
                this.relativeContainer = null;
                if (!o.containment) { this.containment = null; return }
                if (o.containment === "window") { this.containment = [$(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left, $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top, $(window).scrollLeft() + $(window).width() - this.helperProportions.width - this.margins.left, $(window).scrollTop() + ($(window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top]; return }
                if (o.containment === "document") { this.containment = [0, 0, $(document).width() - this.helperProportions.width - this.margins.left, ($(document).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top]; return }
                if (o.containment.constructor === Array) { this.containment = o.containment; return }
                if (o.containment === "parent") { o.containment = this.helper[0].parentNode } c = $(o.containment);
                ce = c[0];
                if (!ce) { return } isUserScrollable = /(scroll|auto)/.test(c.css("overflow"));
                this.containment = [(parseInt(c.css("borderLeftWidth"), 10) || 0) + (parseInt(c.css("paddingLeft"), 10) || 0), (parseInt(c.css("borderTopWidth"), 10) || 0) + (parseInt(c.css("paddingTop"), 10) || 0), (isUserScrollable ? Math.max(ce.scrollWidth, ce.offsetWidth) : ce.offsetWidth) - (parseInt(c.css("borderRightWidth"), 10) || 0) - (parseInt(c.css("paddingRight"), 10) || 0) - this.helperProportions.width - this.margins.left - this.margins.right, (isUserScrollable ? Math.max(ce.scrollHeight, ce.offsetHeight) : ce.offsetHeight) - (parseInt(c.css("borderBottomWidth"), 10) || 0) - (parseInt(c.css("paddingBottom"), 10) || 0) - this.helperProportions.height - this.margins.top - this.margins.bottom];
                this.relativeContainer = c
            },
            _convertPositionTo: function(d, pos) {
                if (!pos) { pos = this.position }
                var mod = d === "absolute" ? 1 : -1,
                    scrollIsRootNode = this._isRootNode(this.scrollParent[0]);
                return { top: pos.top + this.offset.relative.top * mod + this.offset.parent.top * mod - (this.cssPosition === "fixed" ? -this.offset.scroll.top : scrollIsRootNode ? 0 : this.offset.scroll.top) * mod, left: pos.left + this.offset.relative.left * mod + this.offset.parent.left * mod - (this.cssPosition === "fixed" ? -this.offset.scroll.left : scrollIsRootNode ? 0 : this.offset.scroll.left) * mod }
            },
            _generatePosition: function(event, constrainPosition) {
                var containment, co, top, left, o = this.options,
                    scrollIsRootNode = this._isRootNode(this.scrollParent[0]),
                    pageX = event.pageX,
                    pageY = event.pageY;
                if (!scrollIsRootNode || !this.offset.scroll) { this.offset.scroll = { top: this.scrollParent.scrollTop(), left: this.scrollParent.scrollLeft() } }
                if (constrainPosition) {
                    if (this.containment) {
                        if (this.relativeContainer) {
                            co = this.relativeContainer.offset();
                            containment = [this.containment[0] + co.left, this.containment[1] + co.top, this.containment[2] + co.left, this.containment[3] + co.top]
                        } else { containment = this.containment }
                        if (event.pageX - this.offset.click.left < containment[0]) { pageX = containment[0] + this.offset.click.left }
                        if (event.pageY - this.offset.click.top < containment[1]) { pageY = containment[1] + this.offset.click.top }
                        if (event.pageX - this.offset.click.left > containment[2]) { pageX = containment[2] + this.offset.click.left }
                        if (event.pageY - this.offset.click.top > containment[3]) { pageY = containment[3] + this.offset.click.top }
                    }
                    if (o.grid) {
                        top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
                        pageY = containment ? top - this.offset.click.top >= containment[1] || top - this.offset.click.top > containment[3] ? top : top - this.offset.click.top >= containment[1] ? top - o.grid[1] : top + o.grid[1] : top;
                        left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
                        pageX = containment ? left - this.offset.click.left >= containment[0] || left - this.offset.click.left > containment[2] ? left : left - this.offset.click.left >= containment[0] ? left - o.grid[0] : left + o.grid[0] : left
                    }
                    if (o.axis === "y") { pageX = this.originalPageX }
                    if (o.axis === "x") { pageY = this.originalPageY }
                }
                return { top: pageY - this.offset.click.top - this.offset.relative.top - this.offset.parent.top + (this.cssPosition === "fixed" ? -this.offset.scroll.top : scrollIsRootNode ? 0 : this.offset.scroll.top), left: pageX - this.offset.click.left - this.offset.relative.left - this.offset.parent.left + (this.cssPosition === "fixed" ? -this.offset.scroll.left : scrollIsRootNode ? 0 : this.offset.scroll.left) }
            },
            _clear: function() {
                this._removeClass(this.helper, "ui-draggable-dragging");
                if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) { this.helper.remove() } this.helper = null;
                this.cancelHelperRemoval = false;
                if (this.destroyOnClear) { this.destroy() }
            },
            _trigger: function(type, event, ui) {
                ui = ui || this._uiHash();
                $.ui.plugin.call(this, type, [event, ui, this], true);
                if (/^(drag|start|stop)/.test(type)) {
                    this.positionAbs = this._convertPositionTo("absolute");
                    ui.offset = this.positionAbs
                }
                return $.Widget.prototype._trigger.call(this, type, event, ui)
            },
            plugins: {},
            _uiHash: function() { return { helper: this.helper, position: this.position, originalPosition: this.originalPosition, offset: this.positionAbs } }
        });
        $.ui.plugin.add("draggable", "connectToSortable", {
            start: function(event, ui, draggable) {
                var uiSortable = $.extend({}, ui, { item: draggable.element });
                draggable.sortables = [];
                $(draggable.options.connectToSortable).each(function() {
                    var sortable = $(this).sortable("instance");
                    if (sortable && !sortable.options.disabled) {
                        draggable.sortables.push(sortable);
                        sortable.refreshPositions();
                        sortable._trigger("activate", event, uiSortable)
                    }
                })
            },
            stop: function(event, ui, draggable) {
                var uiSortable = $.extend({}, ui, { item: draggable.element });
                draggable.cancelHelperRemoval = false;
                $.each(draggable.sortables, function() {
                    var sortable = this;
                    if (sortable.isOver) {
                        sortable.isOver = 0;
                        draggable.cancelHelperRemoval = true;
                        sortable.cancelHelperRemoval = false;
                        sortable._storedCSS = { position: sortable.placeholder.css("position"), top: sortable.placeholder.css("top"), left: sortable.placeholder.css("left") };
                        sortable._mouseStop(event);
                        sortable.options.helper = sortable.options._helper
                    } else {
                        sortable.cancelHelperRemoval = true;
                        sortable._trigger("deactivate", event, uiSortable)
                    }
                })
            },
            drag: function(event, ui, draggable) {
                $.each(draggable.sortables, function() {
                    var innermostIntersecting = false,
                        sortable = this;
                    sortable.positionAbs = draggable.positionAbs;
                    sortable.helperProportions = draggable.helperProportions;
                    sortable.offset.click = draggable.offset.click;
                    if (sortable._intersectsWith(sortable.containerCache)) {
                        innermostIntersecting = true;
                        $.each(draggable.sortables, function() {
                            this.positionAbs = draggable.positionAbs;
                            this.helperProportions = draggable.helperProportions;
                            this.offset.click = draggable.offset.click;
                            if (this !== sortable && this._intersectsWith(this.containerCache) && $.contains(sortable.element[0], this.element[0])) { innermostIntersecting = false }
                            return innermostIntersecting
                        })
                    }
                    if (innermostIntersecting) {
                        if (!sortable.isOver) {
                            sortable.isOver = 1;
                            draggable._parent = ui.helper.parent();
                            sortable.currentItem = ui.helper.appendTo(sortable.element).data("ui-sortable-item", true);
                            sortable.options._helper = sortable.options.helper;
                            sortable.options.helper = function() { return ui.helper[0] };
                            event.target = sortable.currentItem[0];
                            sortable._mouseCapture(event, true);
                            sortable._mouseStart(event, true, true);
                            sortable.offset.click.top = draggable.offset.click.top;
                            sortable.offset.click.left = draggable.offset.click.left;
                            sortable.offset.parent.left -= draggable.offset.parent.left - sortable.offset.parent.left;
                            sortable.offset.parent.top -= draggable.offset.parent.top - sortable.offset.parent.top;
                            draggable._trigger("toSortable", event);
                            draggable.dropped = sortable.element;
                            $.each(draggable.sortables, function() { this.refreshPositions() });
                            draggable.currentItem = draggable.element;
                            sortable.fromOutside = draggable
                        }
                        if (sortable.currentItem) {
                            sortable._mouseDrag(event);
                            ui.position = sortable.position
                        }
                    } else {
                        if (sortable.isOver) {
                            sortable.isOver = 0;
                            sortable.cancelHelperRemoval = true;
                            sortable.options._revert = sortable.options.revert;
                            sortable.options.revert = false;
                            sortable._trigger("out", event, sortable._uiHash(sortable));
                            sortable._mouseStop(event, true);
                            sortable.options.revert = sortable.options._revert;
                            sortable.options.helper = sortable.options._helper;
                            if (sortable.placeholder) { sortable.placeholder.remove() } ui.helper.appendTo(draggable._parent);
                            draggable._refreshOffsets(event);
                            ui.position = draggable._generatePosition(event, true);
                            draggable._trigger("fromSortable", event);
                            draggable.dropped = false;
                            $.each(draggable.sortables, function() { this.refreshPositions() })
                        }
                    }
                })
            }
        });
        $.ui.plugin.add("draggable", "cursor", {
            start: function(event, ui, instance) {
                var t = $("body"),
                    o = instance.options;
                if (t.css("cursor")) { o._cursor = t.css("cursor") } t.css("cursor", o.cursor)
            },
            stop: function(event, ui, instance) { var o = instance.options; if (o._cursor) { $("body").css("cursor", o._cursor) } }
        });
        $.ui.plugin.add("draggable", "opacity", {
            start: function(event, ui, instance) {
                var t = $(ui.helper),
                    o = instance.options;
                if (t.css("opacity")) { o._opacity = t.css("opacity") } t.css("opacity", o.opacity)
            },
            stop: function(event, ui, instance) { var o = instance.options; if (o._opacity) { $(ui.helper).css("opacity", o._opacity) } }
        });
        $.ui.plugin.add("draggable", "scroll", {
            start: function(event, ui, i) { if (!i.scrollParentNotHidden) { i.scrollParentNotHidden = i.helper.scrollParent(false) } if (i.scrollParentNotHidden[0] !== i.document[0] && i.scrollParentNotHidden[0].tagName !== "HTML") { i.overflowOffset = i.scrollParentNotHidden.offset() } },
            drag: function(event, ui, i) {
                var o = i.options,
                    scrolled = false,
                    scrollParent = i.scrollParentNotHidden[0],
                    document = i.document[0];
                if (scrollParent !== document && scrollParent.tagName !== "HTML") { if (!o.axis || o.axis !== "x") { if (i.overflowOffset.top + scrollParent.offsetHeight - event.pageY < o.scrollSensitivity) { scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed } else if (event.pageY - i.overflowOffset.top < o.scrollSensitivity) { scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed } } if (!o.axis || o.axis !== "y") { if (i.overflowOffset.left + scrollParent.offsetWidth - event.pageX < o.scrollSensitivity) { scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed } else if (event.pageX - i.overflowOffset.left < o.scrollSensitivity) { scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed } } } else { if (!o.axis || o.axis !== "x") { if (event.pageY - $(document).scrollTop() < o.scrollSensitivity) { scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed) } else if ($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) { scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed) } } if (!o.axis || o.axis !== "y") { if (event.pageX - $(document).scrollLeft() < o.scrollSensitivity) { scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed) } else if ($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) { scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed) } } }
                if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) { $.ui.ddmanager.prepareOffsets(i, event) }
            }
        });
        $.ui.plugin.add("draggable", "snap", {
            start: function(event, ui, i) {
                var o = i.options;
                i.snapElements = [];
                $(o.snap.constructor !== String ? o.snap.items || ":data(ui-draggable)" : o.snap).each(function() {
                    var $t = $(this),
                        $o = $t.offset();
                    if (this !== i.element[0]) { i.snapElements.push({ item: this, width: $t.outerWidth(), height: $t.outerHeight(), top: $o.top, left: $o.left }) }
                })
            },
            drag: function(event, ui, inst) {
                var ts, bs, ls, rs, l, r, t, b, i, first, o = inst.options,
                    d = o.snapTolerance,
                    x1 = ui.offset.left,
                    x2 = x1 + inst.helperProportions.width,
                    y1 = ui.offset.top,
                    y2 = y1 + inst.helperProportions.height;
                for (i = inst.snapElements.length - 1; i >= 0; i--) {
                    l = inst.snapElements[i].left - inst.margins.left;
                    r = l + inst.snapElements[i].width;
                    t = inst.snapElements[i].top - inst.margins.top;
                    b = t + inst.snapElements[i].height;
                    if (x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || !$.contains(inst.snapElements[i].item.ownerDocument, inst.snapElements[i].item)) { if (inst.snapElements[i].snapping) { inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })) } inst.snapElements[i].snapping = false; continue }
                    if (o.snapMode !== "inner") {
                        ts = Math.abs(t - y2) <= d;
                        bs = Math.abs(b - y1) <= d;
                        ls = Math.abs(l - x2) <= d;
                        rs = Math.abs(r - x1) <= d;
                        if (ts) { ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top }
                        if (bs) { ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top }
                        if (ls) { ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left }
                        if (rs) { ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left }
                    }
                    first = ts || bs || ls || rs;
                    if (o.snapMode !== "outer") {
                        ts = Math.abs(t - y1) <= d;
                        bs = Math.abs(b - y2) <= d;
                        ls = Math.abs(l - x1) <= d;
                        rs = Math.abs(r - x2) <= d;
                        if (ts) { ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top }
                        if (bs) { ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top }
                        if (ls) { ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left }
                        if (rs) { ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left }
                    }
                    if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) { inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })) } inst.snapElements[i].snapping = ts || bs || ls || rs || first
                }
            }
        });
        $.ui.plugin.add("draggable", "stack", {
            start: function(event, ui, instance) {
                var min, o = instance.options,
                    group = $.makeArray($(o.stack)).sort(function(a, b) { return (parseInt($(a).css("zIndex"), 10) || 0) - (parseInt($(b).css("zIndex"), 10) || 0) });
                if (!group.length) { return } min = parseInt($(group[0]).css("zIndex"), 10) || 0;
                $(group).each(function(i) { $(this).css("zIndex", min + i) });
                this.css("zIndex", min + group.length)
            }
        });
        $.ui.plugin.add("draggable", "zIndex", {
            start: function(event, ui, instance) {
                var t = $(ui.helper),
                    o = instance.options;
                if (t.css("zIndex")) { o._zIndex = t.css("zIndex") } t.css("zIndex", o.zIndex)
            },
            stop: function(event, ui, instance) { var o = instance.options; if (o._zIndex) { $(ui.helper).css("zIndex", o._zIndex) } }
        });
        var widgetsDraggable = $.ui.draggable;

        /*放置*/
        $.widget("ui.droppable", {
            version: "1.12.1",
            widgetEventPrefix: "drop",
            options: { accept: "*", addClasses: true, greedy: false, scope: "default", tolerance: "intersect", activate: null, deactivate: null, drop: null, out: null, over: null },
            _create: function() {
                var proportions, o = this.options,
                    accept = o.accept;
                this.isover = false;
                this.isout = true;
                this.accept = $.isFunction(accept) ? accept : function(d) { return d.is(accept) };
                this.proportions = function() { if (arguments.length) { proportions = arguments[0] } else { return proportions ? proportions : proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight } } };
                this._addToManager(o.scope);
                o.addClasses && this._addClass("ui-droppable")
            },
            _addToManager: function(scope) {
                $.ui.ddmanager.droppables[scope] = $.ui.ddmanager.droppables[scope] || [];
                $.ui.ddmanager.droppables[scope].push(this)
            },
            _splice: function(drop) { var i = 0; for (; i < drop.length; i++) { if (drop[i] === this) { drop.splice(i, 1) } } },
            _destroy: function() {
                var drop = $.ui.ddmanager.droppables[this.options.scope];
                this._splice(drop)
            },
            _setOption: function(key, value) {
                if (key === "accept") { this.accept = $.isFunction(value) ? value : function(d) { return d.is(value) } } else if (key === "scope") {
                    var drop = $.ui.ddmanager.droppables[this.options.scope];
                    this._splice(drop);
                    this._addToManager(value)
                }
                this._super(key, value)
            },
            _activate: function(event) {
                var draggable = $.ui.ddmanager.current;
                this._addActiveClass();
                if (draggable) { this._trigger("activate", event, this.ui(draggable)) }
            },
            _deactivate: function(event) {
                var draggable = $.ui.ddmanager.current;
                this._removeActiveClass();
                if (draggable) { this._trigger("deactivate", event, this.ui(draggable)) }
            },
            _over: function(event) {
                var draggable = $.ui.ddmanager.current;
                if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) { return }
                if (this.accept.call(this.element[0], draggable.currentItem || draggable.element)) {
                    this._addHoverClass();
                    this._trigger("over", event, this.ui(draggable))
                }
            },
            _out: function(event) {
                var draggable = $.ui.ddmanager.current;
                if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) { return }
                if (this.accept.call(this.element[0], draggable.currentItem || draggable.element)) {
                    this._removeHoverClass();
                    this._trigger("out", event, this.ui(draggable))
                }
            },
            _drop: function(event, custom) {
                var draggable = custom || $.ui.ddmanager.current,
                    childrenIntersection = false;
                if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) { return false } this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function() { var inst = $(this).droppable("instance"); if (inst.options.greedy && !inst.options.disabled && inst.options.scope === draggable.options.scope && inst.accept.call(inst.element[0], draggable.currentItem || draggable.element) && intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance, event)) { childrenIntersection = true; return false } });
                if (childrenIntersection) { return false }
                if (this.accept.call(this.element[0], draggable.currentItem || draggable.element)) {
                    this._removeActiveClass();
                    this._removeHoverClass();
                    this._trigger("drop", event, this.ui(draggable));
                    return this.element
                }
                return false
            },
            ui: function(c) { return { draggable: c.currentItem || c.element, helper: c.helper, position: c.position, offset: c.positionAbs } },
            _addHoverClass: function() { this._addClass("ui-droppable-hover") },
            _removeHoverClass: function() { this._removeClass("ui-droppable-hover") },
            _addActiveClass: function() { this._addClass("ui-droppable-active") },
            _removeActiveClass: function() { this._removeClass("ui-droppable-active") }
        });
        var intersect = $.ui.intersect = function() {
            function isOverAxis(x, reference, size) { return x >= reference && x < reference + size }
            return function(draggable, droppable, toleranceMode, event) {
                if (!droppable.offset) { return false }
                var x1 = (draggable.positionAbs || draggable.position.absolute).left + draggable.margins.left,
                    y1 = (draggable.positionAbs || draggable.position.absolute).top + draggable.margins.top,
                    x2 = x1 + draggable.helperProportions.width,
                    y2 = y1 + draggable.helperProportions.height,
                    l = droppable.offset.left,
                    t = droppable.offset.top,
                    r = l + droppable.proportions().width,
                    b = t + droppable.proportions().height;
                switch (toleranceMode) {
                    case "fit":
                        return l <= x1 && x2 <= r && t <= y1 && y2 <= b;
                    case "intersect":
                        return l < x1 + draggable.helperProportions.width / 2 && x2 - draggable.helperProportions.width / 2 < r && t < y1 + draggable.helperProportions.height / 2 && y2 - draggable.helperProportions.height / 2 < b;
                    case "pointer":
                        return isOverAxis(event.pageY, t, droppable.proportions().height) && isOverAxis(event.pageX, l, droppable.proportions().width);
                    case "touch":
                        return (y1 >= t && y1 <= b || y2 >= t && y2 <= b || y1 < t && y2 > b) && (x1 >= l && x1 <= r || x2 >= l && x2 <= r || x1 < l && x2 > r);
                    default:
                        return false
                }
            }
        }();
        $.ui.ddmanager = {
            current: null,
            droppables: { "default": [] },
            prepareOffsets: function(t, event) {
                var i, j, m = $.ui.ddmanager.droppables[t.options.scope] || [],
                    type = event ? event.type : null,
                    list = (t.currentItem || t.element).find(":data(ui-droppable)").addBack();
                droppablesLoop: for (i = 0; i < m.length; i++) {
                    if (m[i].options.disabled || t && !m[i].accept.call(m[i].element[0], t.currentItem || t.element)) { continue }
                    for (j = 0; j < list.length; j++) { if (list[j] === m[i].element[0]) { m[i].proportions().height = 0; continue droppablesLoop } } m[i].visible = m[i].element.css("display") !== "none";
                    if (!m[i].visible) { continue }
                    if (type === "mousedown") { m[i]._activate.call(m[i], event) } m[i].offset = m[i].element.offset();
                    m[i].proportions({ width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight })
                }
            },
            drop: function(draggable, event) {
                var dropped = false;
                $.each(($.ui.ddmanager.droppables[draggable.options.scope] || []).slice(), function() {
                    if (!this.options) { return }
                    if (!this.options.disabled && this.visible && intersect(draggable, this, this.options.tolerance, event)) { dropped = this._drop.call(this, event) || dropped }
                    if (!this.options.disabled && this.visible && this.accept.call(this.element[0], draggable.currentItem || draggable.element)) {
                        this.isout = true;
                        this.isover = false;
                        this._deactivate.call(this, event)
                    }
                });
                return dropped
            },
            dragStart: function(draggable, event) { draggable.element.parentsUntil("body").on("scroll.droppable", function() { if (!draggable.options.refreshPositions) { $.ui.ddmanager.prepareOffsets(draggable, event) } }) },
            drag: function(draggable, event) {
                if (draggable.options.refreshPositions) { $.ui.ddmanager.prepareOffsets(draggable, event) } $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
                    if (this.options.disabled || this.greedyChild || !this.visible) { return }
                    var parentInstance, scope, parent, intersects = intersect(draggable, this, this.options.tolerance, event),
                        c = !intersects && this.isover ? "isout" : intersects && !this.isover ? "isover" : null;
                    if (!c) { return }
                    if (this.options.greedy) {
                        scope = this.options.scope;
                        parent = this.element.parents(":data(ui-droppable)").filter(function() { return $(this).droppable("instance").options.scope === scope });
                        if (parent.length) {
                            parentInstance = $(parent[0]).droppable("instance");
                            parentInstance.greedyChild = c === "isover"
                        }
                    }
                    if (parentInstance && c === "isover") {
                        parentInstance.isover = false;
                        parentInstance.isout = true;
                        parentInstance._out.call(parentInstance, event)
                    }
                    this[c] = true;
                    this[c === "isout" ? "isover" : "isout"] = false;
                    this[c === "isover" ? "_over" : "_out"].call(this, event);
                    if (parentInstance && c === "isout") {
                        parentInstance.isout = false;
                        parentInstance.isover = true;
                        parentInstance._over.call(parentInstance, event)
                    }
                })
            },
            dragStop: function(draggable, event) { draggable.element.parentsUntil("body").off("scroll.droppable"); if (!draggable.options.refreshPositions) { $.ui.ddmanager.prepareOffsets(draggable, event) } }
        };
        if ($.uiBackCompat !== false) { $.widget("ui.droppable", $.ui.droppable, { options: { hoverClass: false, activeClass: false }, _addActiveClass: function() { this._super(); if (this.options.activeClass) { this.element.addClass(this.options.activeClass) } }, _removeActiveClass: function() { this._super(); if (this.options.activeClass) { this.element.removeClass(this.options.activeClass) } }, _addHoverClass: function() { this._super(); if (this.options.hoverClass) { this.element.addClass(this.options.hoverClass) } }, _removeHoverClass: function() { this._super(); if (this.options.hoverClass) { this.element.removeClass(this.options.hoverClass) } } }) }
        var widgetsDroppable = $.ui.droppable;

        /*调整尺寸大小*/
        $.widget("ui.resizable", $.ui.mouse, {
            version: "1.12.1",
            widgetEventPrefix: "resize",
            options: { 
                alsoResize: false, 
                animate: false, 
                animateDuration: "slow", 
                animateEasing: "swing", 
                aspectRatio: false, 
                autoHide: false, 
                classes: { 
                    "ui-resizable-se": "ui-icon auxui-icon" 
                }, containment: false, ghost: false, grid: false, handles: "e,s,se", helper: false, maxHeight: null, maxWidth: null, minHeight: 10, minWidth: 10, zIndex: 90, resize: null, start: null, stop: null },
            _num: function(value) { return parseFloat(value) || 0 },
            _isNumber: function(value) { return !isNaN(parseFloat(value)) },
            _hasScroll: function(el, a) {
                if ($(el).css("overflow") === "hidden") { return false }
                var scroll = a && a === "left" ? "scrollLeft" : "scrollTop",has = false;
                if (el[scroll] > 0) { return true } 
                if(typeof(el) == 'object'){
                    el[scroll] = 1;
                    has = el[scroll] > 0;
                    el[scroll] = 0;
                }else{
                    has = false;
                }
                return has
            },
            _create: function() {
                var margins, o = this.options,
                    that = this;
                this._addClass("ui-resizable");

                $.extend(this, { _aspectRatio: !!o.aspectRatio, aspectRatio: o.aspectRatio, originalElement: this.element, _proportionallyResizeElements: [], _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null });
                if (this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)) {
                    this.element.wrap($("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({ position: this.element.css("position"), width: this.element.outerWidth(), height: this.element.outerHeight(), top: this.element.css("top"), left: this.element.css("left") }));
                    this.element = this.element.parent().data("ui-resizable", this.element.resizable("instance"));
                    this.elementIsWrapper = true;
                    margins = { marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom"), marginLeft: this.originalElement.css("marginLeft") };
                    this.element.css(margins);
                    this.originalElement.css("margin", 0);
                    this.originalResizeStyle = this.originalElement.css("resize");
                    this.originalElement.css("resize", "none");
                    this._proportionallyResizeElements.push(this.originalElement.css({ position: "static", zoom: 1, display: "block" }));
                    this.originalElement.css(margins);
                    this._proportionallyResize();
                }
                this._setupHandles();
                if (o.autoHide) {
                    $(this.element).on("mouseenter", function() {
                        if (o.disabled) { return } that._removeClass("ui-resizable-autohide");
                        that._handles.show()
                    }).on("mouseleave", function() {
                        if (o.disabled) { return }
                        if (!that.resizing) {
                            that._addClass("ui-resizable-autohide");
                            that._handles.hide()
                        }
                    })
                }
                this.element.find('.ui-resizable-se.auxui-icon').html('&#xe660;').css({'font-size':'12px','color':'#444'});

                this._mouseInit()
            },
            _destroy: function() {
                this._mouseDestroy();
                var wrapper, _destroy = function(exp) { $(exp).removeData("resizable").removeData("ui-resizable").off(".resizable").find(".ui-resizable-handle").remove() };
                if (this.elementIsWrapper) {
                    _destroy(this.element);
                    wrapper = this.element;
                    this.originalElement.css({ position: wrapper.css("position"), width: wrapper.outerWidth(), height: wrapper.outerHeight(), top: wrapper.css("top"), left: wrapper.css("left") }).insertAfter(wrapper);
                    wrapper.remove()
                }
                this.originalElement.css("resize", this.originalResizeStyle);
                _destroy(this.originalElement);
                return this
            },
            _setOption: function(key, value) {
                this._super(key, value);
                switch (key) {
                    case "handles":
                        this._removeHandles();
                        this._setupHandles();
                        break;
                    default:
                        break
                }
            },
            _setupHandles: function() {
                var o = this.options,
                    handle, i, n, hname, axis, that = this;
                this.handles = o.handles || (!$(".ui-resizable-handle", this.element).length ? "e,s,se" : { n: ".ui-resizable-n", e: ".ui-resizable-e", s: ".ui-resizable-s", w: ".ui-resizable-w", se: ".ui-resizable-se", sw: ".ui-resizable-sw", ne: ".ui-resizable-ne", nw: ".ui-resizable-nw" });
                this._handles = $();
                if (this.handles.constructor === String) {
                    if (this.handles === "all") { this.handles = "n,e,s,w,se,sw,ne,nw" } n = this.handles.split(",");
                    this.handles = {};
                    for (i = 0; i < n.length; i++) {
                        handle = $.trim(n[i]);
                        hname = "ui-resizable-" + handle;
                        axis = $("<div>");
                        this._addClass(axis, "ui-resizable-handle " + hname);
                        axis.css({ zIndex: o.zIndex });
                        this.handles[handle] = ".ui-resizable-" + handle;
                        this.element.append(axis)
                    }
                }
                this._renderAxis = function(target) {
                    var i, axis, padPos, padWrapper;
                    target = target || this.element;
                    for (i in this.handles) {
                        if (this.handles[i].constructor === String) { this.handles[i] = this.element.children(this.handles[i]).first().show() } else if (this.handles[i].jquery || this.handles[i].nodeType) {
                            this.handles[i] = $(this.handles[i]);
                            this._on(this.handles[i], { mousedown: that._mouseDown })
                        }
                        if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)) {
                            axis = $(this.handles[i], this.element);
                            padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
                            padPos = ["padding", /ne|nw|n/.test(i) ? "Top" : /se|sw|s/.test(i) ? "Bottom" : /^e$/.test(i) ? "Right" : "Left"].join("");
                            target.css(padPos, padWrapper);
                            this._proportionallyResize()
                        }
                        this._handles = this._handles.add(this.handles[i])
                    }
                };
                this._renderAxis(this.element);
                this._handles = this._handles.add(this.element.find(".ui-resizable-handle"));
                this._handles.disableSelection();
                this._handles.on("mouseover", function() { if (!that.resizing) { if (this.className) { axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i) } that.axis = axis && axis[1] ? axis[1] : "se" } });
                if (o.autoHide) {
                    this._handles.hide();
                    this._addClass("ui-resizable-autohide")
                }
            },
            _removeHandles: function() { this._handles.remove() },
            _mouseCapture: function(event) { var i, handle, capture = false; for (i in this.handles) { handle = $(this.handles[i])[0]; if (handle === event.target || $.contains(handle, event.target)) { capture = true } } return !this.options.disabled && capture },
            _mouseStart: function(event) {
                var curleft, curtop, cursor, o = this.options,
                    el = this.element;
                this.resizing = true;
                this._renderProxy();
                curleft = this._num(this.helper.css("left"));
                curtop = this._num(this.helper.css("top"));
                if (o.containment) {
                    curleft += $(o.containment).scrollLeft() || 0;
                    curtop += $(o.containment).scrollTop() || 0
                }
                this.offset = this.helper.offset();
                this.position = { left: curleft, top: curtop };
                this.size = this._helper ? { width: this.helper.width(), height: this.helper.height() } : { width: el.width(), height: el.height() };
                this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
                this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
                this.originalPosition = { left: curleft, top: curtop };
                this.originalMousePosition = { left: event.pageX, top: event.pageY };
                this.aspectRatio = typeof o.aspectRatio === "number" ? o.aspectRatio : this.originalSize.width / this.originalSize.height || 1;
                cursor = $(".ui-resizable-" + this.axis).css("cursor");
                $("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor);
                this._addClass("ui-resizable-resizing");
                this._propagate("start", event);
                return true
            },
            _mouseDrag: function(event) {
                var data, props, smp = this.originalMousePosition,
                    a = this.axis,
                    dx = event.pageX - smp.left || 0,
                    dy = event.pageY - smp.top || 0,
                    trigger = this._change[a];
                this._updatePrevProperties();
                if (!trigger) { return false } data = trigger.apply(this, [event, dx, dy]);
                this._updateVirtualBoundaries(event.shiftKey);
                if (this._aspectRatio || event.shiftKey) { data = this._updateRatio(data, event) } data = this._respectSize(data, event);
                this._updateCache(data);
                this._propagate("resize", event);
                props = this._applyChanges();
                if (!this._helper && this._proportionallyResizeElements.length) { this._proportionallyResize() }
                if (!$.isEmptyObject(props)) {
                    this._updatePrevProperties();
                    this._trigger("resize", event, this.ui());
                    this._applyChanges()
                }
                return false
            },
            _mouseStop: function(event) {
                this.resizing = false;
                var pr, ista, soffseth, soffsetw, s, left, top, o = this.options,
                    that = this;
                if (this._helper) {
                    pr = this._proportionallyResizeElements;
                    ista = pr.length && /textarea/i.test(pr[0].nodeName);
                    soffseth = ista && this._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height;
                    soffsetw = ista ? 0 : that.sizeDiff.width;
                    s = { width: that.helper.width() - soffsetw, height: that.helper.height() - soffseth };
                    left = parseFloat(that.element.css("left")) + (that.position.left - that.originalPosition.left) || null;
                    top = parseFloat(that.element.css("top")) + (that.position.top - that.originalPosition.top) || null;
                    if (!o.animate) { this.element.css($.extend(s, { top: top, left: left })) } that.helper.height(that.size.height);
                    that.helper.width(that.size.width);
                    if (this._helper && !o.animate) { this._proportionallyResize() }
                }
                $("body").css("cursor", "auto");
                this._removeClass("ui-resizable-resizing");
                this._propagate("stop", event);
                if (this._helper) { this.helper.remove() }
                return false
            },
            _updatePrevProperties: function() {
                this.prevPosition = { top: this.position.top, left: this.position.left };
                this.prevSize = { width: this.size.width, height: this.size.height }
            },
            _applyChanges: function() { var props = {}; if (this.position.top !== this.prevPosition.top) { props.top = this.position.top + "px" } if (this.position.left !== this.prevPosition.left) { props.left = this.position.left + "px" } if (this.size.width !== this.prevSize.width) { props.width = this.size.width + "px" } if (this.size.height !== this.prevSize.height) { props.height = this.size.height + "px" } this.helper.css(props); return props },
            _updateVirtualBoundaries: function(forceAspectRatio) {
                var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b, o = this.options;
                b = { minWidth: this._isNumber(o.minWidth) ? o.minWidth : 0, maxWidth: this._isNumber(o.maxWidth) ? o.maxWidth : Infinity, minHeight: this._isNumber(o.minHeight) ? o.minHeight : 0, maxHeight: this._isNumber(o.maxHeight) ? o.maxHeight : Infinity };
                if (this._aspectRatio || forceAspectRatio) {
                    pMinWidth = b.minHeight * this.aspectRatio;
                    pMinHeight = b.minWidth / this.aspectRatio;
                    pMaxWidth = b.maxHeight * this.aspectRatio;
                    pMaxHeight = b.maxWidth / this.aspectRatio;
                    if (pMinWidth > b.minWidth) { b.minWidth = pMinWidth }
                    if (pMinHeight > b.minHeight) { b.minHeight = pMinHeight }
                    if (pMaxWidth < b.maxWidth) { b.maxWidth = pMaxWidth }
                    if (pMaxHeight < b.maxHeight) { b.maxHeight = pMaxHeight }
                }
                this._vBoundaries = b
            },
            _updateCache: function(data) { this.offset = this.helper.offset(); if (this._isNumber(data.left)) { this.position.left = data.left } if (this._isNumber(data.top)) { this.position.top = data.top } if (this._isNumber(data.height)) { this.size.height = data.height } if (this._isNumber(data.width)) { this.size.width = data.width } },
            _updateRatio: function(data) {
                var cpos = this.position,
                    csize = this.size,
                    a = this.axis;
                if (this._isNumber(data.height)) { data.width = data.height * this.aspectRatio } else if (this._isNumber(data.width)) { data.height = data.width / this.aspectRatio }
                if (a === "sw") {
                    data.left = cpos.left + (csize.width - data.width);
                    data.top = null
                }
                if (a === "nw") {
                    data.top = cpos.top + (csize.height - data.height);
                    data.left = cpos.left + (csize.width - data.width)
                }
                return data
            },
            _respectSize: function(data) {
                var o = this._vBoundaries,
                    a = this.axis,
                    ismaxw = this._isNumber(data.width) && o.maxWidth && o.maxWidth < data.width,
                    ismaxh = this._isNumber(data.height) && o.maxHeight && o.maxHeight < data.height,
                    isminw = this._isNumber(data.width) && o.minWidth && o.minWidth > data.width,
                    isminh = this._isNumber(data.height) && o.minHeight && o.minHeight > data.height,
                    dw = this.originalPosition.left + this.originalSize.width,
                    dh = this.originalPosition.top + this.originalSize.height,
                    cw = /sw|nw|w/.test(a),
                    ch = /nw|ne|n/.test(a);
                if (isminw) { data.width = o.minWidth }
                if (isminh) { data.height = o.minHeight }
                if (ismaxw) { data.width = o.maxWidth }
                if (ismaxh) { data.height = o.maxHeight }
                if (isminw && cw) { data.left = dw - o.minWidth }
                if (ismaxw && cw) { data.left = dw - o.maxWidth }
                if (isminh && ch) { data.top = dh - o.minHeight }
                if (ismaxh && ch) { data.top = dh - o.maxHeight }
                if (!data.width && !data.height && !data.left && data.top) { data.top = null } else if (!data.width && !data.height && !data.top && data.left) { data.left = null }
                return data
            },
            _getPaddingPlusBorderDimensions: function(element) {
                var i = 0,
                    widths = [],
                    borders = [element.css("borderTopWidth"), element.css("borderRightWidth"), element.css("borderBottomWidth"), element.css("borderLeftWidth")],
                    paddings = [element.css("paddingTop"), element.css("paddingRight"), element.css("paddingBottom"), element.css("paddingLeft")];
                for (; i < 4; i++) {
                    widths[i] = parseFloat(borders[i]) || 0;
                    widths[i] += parseFloat(paddings[i]) || 0
                }
                return { height: widths[0] + widths[2], width: widths[1] + widths[3] }
            },
            _proportionallyResize: function() {
                if (!this._proportionallyResizeElements.length) { return }
                var prel, i = 0,
                    element = this.helper || this.element;
                for (; i < this._proportionallyResizeElements.length; i++) { prel = this._proportionallyResizeElements[i]; if (!this.outerDimensions) { this.outerDimensions = this._getPaddingPlusBorderDimensions(prel) } prel.css({ height: element.height() - this.outerDimensions.height || 0, width: element.width() - this.outerDimensions.width || 0 }) }
            },
            _renderProxy: function() {
                var el = this.element,
                    o = this.options;
                this.elementOffset = el.offset();
                if (this._helper) {
                    this.helper = this.helper || $("<div style='overflow:hidden;'></div>");
                    this._addClass(this.helper, this._helper);
                    this.helper.css({ width: this.element.outerWidth(), height: this.element.outerHeight(), position: "absolute", left: this.elementOffset.left + "px", top: this.elementOffset.top + "px", zIndex: ++o.zIndex });
                    this.helper.appendTo("body").disableSelection()
                } else { this.helper = this.element }
            },
            _change: {
                e: function(event, dx) { return { width: this.originalSize.width + dx } },
                w: function(event, dx) {
                    var cs = this.originalSize,
                        sp = this.originalPosition;
                    return { left: sp.left + dx, width: cs.width - dx }
                },
                n: function(event, dx, dy) {
                    var cs = this.originalSize,
                        sp = this.originalPosition;
                    return { top: sp.top + dy, height: cs.height - dy }
                },
                s: function(event, dx, dy) { return { height: this.originalSize.height + dy } },
                se: function(event, dx, dy) { return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy])) },
                sw: function(event, dx, dy) { return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy])) },
                ne: function(event, dx, dy) { return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy])) },
                nw: function(event, dx, dy) { return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy])) }
            },
            _propagate: function(n, event) {
                $.ui.plugin.call(this, n, [event, this.ui()]);
                n !== "resize" && this._trigger(n, event, this.ui())
            },
            plugins: {},
            ui: function() { return { originalElement: this.originalElement, element: this.element, helper: this.helper, position: this.position, size: this.size, originalSize: this.originalSize, originalPosition: this.originalPosition } }
        });
        $.ui.plugin.add("resizable", "animate", {
            stop: function(event) {
                var that = $(this).resizable("instance"),
                    o = that.options,
                    pr = that._proportionallyResizeElements,
                    ista = pr.length && /textarea/i.test(pr[0].nodeName),
                    soffseth = ista && that._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height,
                    soffsetw = ista ? 0 : that.sizeDiff.width,
                    style = { width: that.size.width - soffsetw, height: that.size.height - soffseth },
                    left = parseFloat(that.element.css("left")) + (that.position.left - that.originalPosition.left) || null,
                    top = parseFloat(that.element.css("top")) + (that.position.top - that.originalPosition.top) || null;
                that.element.animate($.extend(style, top && left ? { top: top, left: left } : {}), {
                    duration: o.animateDuration,
                    easing: o.animateEasing,
                    step: function() {
                        var data = { width: parseFloat(that.element.css("width")), height: parseFloat(that.element.css("height")), top: parseFloat(that.element.css("top")), left: parseFloat(that.element.css("left")) };
                        if (pr && pr.length) { $(pr[0]).css({ width: data.width, height: data.height }) } that._updateCache(data);
                        that._propagate("resize", event)
                    }
                })
            }
        });
        $.ui.plugin.add("resizable", "containment", {
            start: function() {
                var element, p, co, ch, cw, width, height, that = $(this).resizable("instance"),
                    o = that.options,
                    el = that.element,
                    oc = o.containment,
                    ce = oc instanceof $ ? oc.get(0) : /parent/.test(oc) ? el.parent().get(0) : oc;
                if (!ce) { return } that.containerElement = $(ce);
                if (/document/.test(oc) || oc === document) {
                    that.containerOffset = { left: 0, top: 0 };
                    that.containerPosition = { left: 0, top: 0 };
                    that.parentData = { element: $(document), left: 0, top: 0, width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight }
                } else {
                    element = $(ce);
                    p = [];
                    $(["Top", "Right", "Left", "Bottom"]).each(function(i, name) { p[i] = that._num(element.css("padding" + name)) });
                    that.containerOffset = element.offset();
                    that.containerPosition = element.position();
                    that.containerSize = { height: element.innerHeight() - p[3], width: element.innerWidth() - p[1] };
                    co = that.containerOffset;
                    ch = that.containerSize.height;
                    cw = that.containerSize.width;
                    width = that._hasScroll(ce, "left") ? ce.scrollWidth : cw;
                    height = that._hasScroll(ce) ? ce.scrollHeight : ch;
                    that.parentData = { element: ce, left: co.left, top: co.top, width: width, height: height }
                }
            },
            resize: function(event) {
                var woset, hoset, isParent, isOffsetRelative, that = $(this).resizable("instance"),
                    o = that.options,
                    co = that.containerOffset,
                    cp = that.position,
                    pRatio = that._aspectRatio || event.shiftKey,
                    cop = { top: 0, left: 0 },
                    ce = that.containerElement,
                    continueResize = true;
                if (ce[0] !== document && /static/.test(ce.css("position"))) { cop = co }
                if (cp.left < (that._helper ? co.left : 0)) {
                    that.size.width = that.size.width + (that._helper ? that.position.left - co.left : that.position.left - cop.left);
                    if (pRatio) {
                        that.size.height = that.size.width / that.aspectRatio;
                        continueResize = false
                    }
                    that.position.left = o.helper ? co.left : 0
                }
                if (cp.top < (that._helper ? co.top : 0)) {
                    that.size.height = that.size.height + (that._helper ? that.position.top - co.top : that.position.top);
                    if (pRatio) {
                        that.size.width = that.size.height * that.aspectRatio;
                        continueResize = false
                    }
                    that.position.top = that._helper ? co.top : 0
                }
                isParent = that.containerElement.get(0) === that.element.parent().get(0);
                isOffsetRelative = /relative|absolute/.test(that.containerElement.css("position"));
                if (isParent && isOffsetRelative) {
                    that.offset.left = that.parentData.left + that.position.left;
                    that.offset.top = that.parentData.top + that.position.top
                } else {
                    that.offset.left = that.element.offset().left;
                    that.offset.top = that.element.offset().top
                }
                woset = Math.abs(that.sizeDiff.width + (that._helper ? that.offset.left - cop.left : that.offset.left - co.left));
                hoset = Math.abs(that.sizeDiff.height + (that._helper ? that.offset.top - cop.top : that.offset.top - co.top));
                if (woset + that.size.width >= that.parentData.width) {
                    that.size.width = that.parentData.width - woset;
                    if (pRatio) {
                        that.size.height = that.size.width / that.aspectRatio;
                        continueResize = false
                    }
                }
                if (hoset + that.size.height >= that.parentData.height) {
                    that.size.height = that.parentData.height - hoset;
                    if (pRatio) {
                        that.size.width = that.size.height * that.aspectRatio;
                        continueResize = false
                    }
                }
                if (!continueResize) {
                    that.position.left = that.prevPosition.left;
                    that.position.top = that.prevPosition.top;
                    that.size.width = that.prevSize.width;
                    that.size.height = that.prevSize.height
                }
            },
            stop: function() {
                var that = $(this).resizable("instance"),
                    o = that.options,
                    co = that.containerOffset,
                    cop = that.containerPosition,
                    ce = that.containerElement,
                    helper = $(that.helper),
                    ho = helper.offset(),
                    w = helper.outerWidth() - that.sizeDiff.width,
                    h = helper.outerHeight() - that.sizeDiff.height;
                if (that._helper && !o.animate && /relative/.test(ce.css("position"))) { $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h }) }
                if (that._helper && !o.animate && /static/.test(ce.css("position"))) { $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h }) }
            }
        });
        $.ui.plugin.add("resizable", "alsoResize", {
            start: function() {
                var that = $(this).resizable("instance"),
                    o = that.options;
                $(o.alsoResize).each(function() {
                    var el = $(this);
                    el.data("ui-resizable-alsoresize", { width: parseFloat(el.width()), height: parseFloat(el.height()), left: parseFloat(el.css("left")), top: parseFloat(el.css("top")) })
                })
            },
            resize: function(event, ui) {
                var that = $(this).resizable("instance"),
                    o = that.options,
                    os = that.originalSize,
                    op = that.originalPosition,
                    delta = { height: that.size.height - os.height || 0, width: that.size.width - os.width || 0, top: that.position.top - op.top || 0, left: that.position.left - op.left || 0 };
                $(o.alsoResize).each(function() {
                    var el = $(this),
                        start = $(this).data("ui-resizable-alsoresize"),
                        style = {},
                        css = el.parents(ui.originalElement[0]).length ? ["width", "height"] : ["width", "height", "top", "left"];
                    $.each(css, function(i, prop) { var sum = (start[prop] || 0) + (delta[prop] || 0); if (sum && sum >= 0) { style[prop] = sum || null } });
                    el.css(style)
                })
            },
            stop: function() { $(this).removeData("ui-resizable-alsoresize") }
        });
        $.ui.plugin.add("resizable", "ghost", {
            start: function() {
                var that = $(this).resizable("instance"),
                    cs = that.size;
                that.ghost = that.originalElement.clone();
                that.ghost.css({ opacity: .25, display: "block", position: "relative", height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 });
                that._addClass(that.ghost, "ui-resizable-ghost");
                if ($.uiBackCompat !== false && typeof that.options.ghost === "string") { that.ghost.addClass(this.options.ghost) } that.ghost.appendTo(that.helper)
            },
            resize: function() { var that = $(this).resizable("instance"); if (that.ghost) { that.ghost.css({ position: "relative", height: that.size.height, width: that.size.width }) } },
            stop: function() { var that = $(this).resizable("instance"); if (that.ghost && that.helper) { that.helper.get(0).removeChild(that.ghost.get(0)) } }
        });
        $.ui.plugin.add("resizable", "grid", {
            resize: function() {
                var outerDimensions, that = $(this).resizable("instance"),
                    o = that.options,
                    cs = that.size,
                    os = that.originalSize,
                    op = that.originalPosition,
                    a = that.axis,
                    grid = typeof o.grid === "number" ? [o.grid, o.grid] : o.grid,
                    gridX = grid[0] || 1,
                    gridY = grid[1] || 1,
                    ox = Math.round((cs.width - os.width) / gridX) * gridX,
                    oy = Math.round((cs.height - os.height) / gridY) * gridY,
                    newWidth = os.width + ox,
                    newHeight = os.height + oy,
                    isMaxWidth = o.maxWidth && o.maxWidth < newWidth,
                    isMaxHeight = o.maxHeight && o.maxHeight < newHeight,
                    isMinWidth = o.minWidth && o.minWidth > newWidth,
                    isMinHeight = o.minHeight && o.minHeight > newHeight;
                o.grid = grid;
                if (isMinWidth) { newWidth += gridX }
                if (isMinHeight) { newHeight += gridY }
                if (isMaxWidth) { newWidth -= gridX }
                if (isMaxHeight) { newHeight -= gridY }
                if (/^(se|s|e)$/.test(a)) {
                    that.size.width = newWidth;
                    that.size.height = newHeight
                } else if (/^(ne)$/.test(a)) {
                    that.size.width = newWidth;
                    that.size.height = newHeight;
                    that.position.top = op.top - oy
                } else if (/^(sw)$/.test(a)) {
                    that.size.width = newWidth;
                    that.size.height = newHeight;
                    that.position.left = op.left - ox
                } else {
                    if (newHeight - gridY <= 0 || newWidth - gridX <= 0) { outerDimensions = that._getPaddingPlusBorderDimensions(this) }
                    if (newHeight - gridY > 0) {
                        that.size.height = newHeight;
                        that.position.top = op.top - oy
                    } else {
                        newHeight = gridY - outerDimensions.height;
                        that.size.height = newHeight;
                        that.position.top = op.top + os.height - newHeight
                    }
                    if (newWidth - gridX > 0) {
                        that.size.width = newWidth;
                        that.position.left = op.left - ox
                    } else {
                        newWidth = gridX - outerDimensions.width;
                        that.size.width = newWidth;
                        that.position.left = op.left + os.width - newWidth
                    }
                }
            }
        });
        var widgetsResizable = $.ui.resizable;

        /*选择*/
        var widgetsSelectable = $.widget("ui.selectable", $.ui.mouse, {
            version: "1.12.1",
            options: { appendTo: "body", autoRefresh: true, distance: 0, filter: "*", tolerance: "touch", selected: null, selecting: null, start: null, stop: null, unselected: null, unselecting: null },
            _create: function() {
                var that = this;
                this._addClass("ui-selectable");
                this.dragged = false;
                this.refresh = function() {
                    that.elementPos = $(that.element[0]).offset();
                    that.selectees = $(that.options.filter, that.element[0]);
                    that._addClass(that.selectees, "ui-selectee");
                    that.selectees.each(function() {
                        var $this = $(this),
                            selecteeOffset = $this.offset(),
                            pos = { left: selecteeOffset.left - that.elementPos.left, top: selecteeOffset.top - that.elementPos.top };
                        $.data(this, "selectable-item", { element: this, $element: $this, left: pos.left, top: pos.top, right: pos.left + $this.outerWidth(), bottom: pos.top + $this.outerHeight(), startselected: false, selected: $this.hasClass("ui-selected"), selecting: $this.hasClass("ui-selecting"), unselecting: $this.hasClass("ui-unselecting") })
                    })
                };
                this.refresh();
                this._mouseInit();
                this.helper = $("<div>");
                this._addClass(this.helper, "ui-selectable-helper")
            },
            _destroy: function() {
                this.selectees.removeData("selectable-item");
                this._mouseDestroy()
            },
            _mouseStart: function(event) {
                var that = this,
                    options = this.options;
                this.opos = [event.pageX, event.pageY];
                this.elementPos = $(this.element[0]).offset();
                if (this.options.disabled) { return } this.selectees = $(options.filter, this.element[0]);
                this._trigger("start", event);
                $(options.appendTo).append(this.helper);
                this.helper.css({ left: event.pageX, top: event.pageY, width: 0, height: 0 });
                if (options.autoRefresh) { this.refresh() } this.selectees.filter(".ui-selected").each(function() {
                    var selectee = $.data(this, "selectable-item");
                    selectee.startselected = true;
                    if (!event.metaKey && !event.ctrlKey) {
                        that._removeClass(selectee.$element, "ui-selected");
                        selectee.selected = false;
                        that._addClass(selectee.$element, "ui-unselecting");
                        selectee.unselecting = true;
                        that._trigger("unselecting", event, { unselecting: selectee.element })
                    }
                });
                $(event.target).parents().addBack().each(function() {
                    var doSelect, selectee = $.data(this, "selectable-item");
                    if (selectee) {
                        doSelect = !event.metaKey && !event.ctrlKey || !selectee.$element.hasClass("ui-selected");
                        that._removeClass(selectee.$element, doSelect ? "ui-unselecting" : "ui-selected")._addClass(selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting");
                        selectee.unselecting = !doSelect;
                        selectee.selecting = doSelect;
                        selectee.selected = doSelect;
                        if (doSelect) { that._trigger("selecting", event, { selecting: selectee.element }) } else { that._trigger("unselecting", event, { unselecting: selectee.element }) }
                        return false
                    }
                })
            },
            _mouseDrag: function(event) {
                this.dragged = true;
                if (this.options.disabled) { return }
                var tmp, that = this,
                    options = this.options,
                    x1 = this.opos[0],
                    y1 = this.opos[1],
                    x2 = event.pageX,
                    y2 = event.pageY;
                if (x1 > x2) {
                    tmp = x2;
                    x2 = x1;
                    x1 = tmp
                }
                if (y1 > y2) {
                    tmp = y2;
                    y2 = y1;
                    y1 = tmp
                }
                this.helper.css({ left: x1, top: y1, width: x2 - x1, height: y2 - y1 });
                this.selectees.each(function() {
                    var selectee = $.data(this, "selectable-item"),
                        hit = false,
                        offset = {};
                    if (!selectee || selectee.element === that.element[0]) { return } offset.left = selectee.left + that.elementPos.left;
                    offset.right = selectee.right + that.elementPos.left;
                    offset.top = selectee.top + that.elementPos.top;
                    offset.bottom = selectee.bottom + that.elementPos.top;
                    if (options.tolerance === "touch") { hit = !(offset.left > x2 || offset.right < x1 || offset.top > y2 || offset.bottom < y1) } else if (options.tolerance === "fit") { hit = offset.left > x1 && offset.right < x2 && offset.top > y1 && offset.bottom < y2 }
                    if (hit) {
                        if (selectee.selected) {
                            that._removeClass(selectee.$element, "ui-selected");
                            selectee.selected = false
                        }
                        if (selectee.unselecting) {
                            that._removeClass(selectee.$element, "ui-unselecting");
                            selectee.unselecting = false
                        }
                        if (!selectee.selecting) {
                            that._addClass(selectee.$element, "ui-selecting");
                            selectee.selecting = true;
                            that._trigger("selecting", event, { selecting: selectee.element })
                        }
                    } else {
                        if (selectee.selecting) {
                            if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
                                that._removeClass(selectee.$element, "ui-selecting");
                                selectee.selecting = false;
                                that._addClass(selectee.$element, "ui-selected");
                                selectee.selected = true
                            } else {
                                that._removeClass(selectee.$element, "ui-selecting");
                                selectee.selecting = false;
                                if (selectee.startselected) {
                                    that._addClass(selectee.$element, "ui-unselecting");
                                    selectee.unselecting = true
                                }
                                that._trigger("unselecting", event, { unselecting: selectee.element })
                            }
                        }
                        if (selectee.selected) {
                            if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
                                that._removeClass(selectee.$element, "ui-selected");
                                selectee.selected = false;
                                that._addClass(selectee.$element, "ui-unselecting");
                                selectee.unselecting = true;
                                that._trigger("unselecting", event, { unselecting: selectee.element })
                            }
                        }
                    }
                });
                return false
            },
            _mouseStop: function(event) {
                var that = this;
                this.dragged = false;
                $(".ui-unselecting", this.element[0]).each(function() {
                    var selectee = $.data(this, "selectable-item");
                    that._removeClass(selectee.$element, "ui-unselecting");
                    selectee.unselecting = false;
                    selectee.startselected = false;
                    that._trigger("unselected", event, { unselected: selectee.element })
                });
                $(".ui-selecting", this.element[0]).each(function() {
                    var selectee = $.data(this, "selectable-item");
                    that._removeClass(selectee.$element, "ui-selecting")._addClass(selectee.$element, "ui-selected");
                    selectee.selecting = false;
                    selectee.selected = true;
                    selectee.startselected = true;
                    that._trigger("selected", event, { selected: selectee.element })
                });
                this._trigger("stop", event);
                this.helper.remove();
                return false
            }
        });

        /*排序*/
        var widgetsSortable = $.widget("ui.sortable", $.ui.mouse, {
            version: "1.12.1",
            widgetEventPrefix: "sort",
            ready: false,
            options: { appendTo: "parent", axis: false, connectWith: false, containment: false, cursor: "auto", cursorAt: false, dropOnEmpty: true, forcePlaceholderSize: false, forceHelperSize: false, grid: false, handle: false, helper: "original", items: "> *", opacity: false, placeholder: false, revert: false, scroll: true, scrollSensitivity: 20, scrollSpeed: 20, scope: "default", tolerance: "intersect", zIndex: 1e3, activate: null, beforeStop: null, change: null, deactivate: null, out: null, over: null, receive: null, remove: null, sort: null, start: null, stop: null, update: null },
            _isOverAxis: function(x, reference, size) { return x >= reference && x < reference + size },
            _isFloating: function(item) { return /left|right/.test(item.css("float")) || /inline|table-cell/.test(item.css("display")) },
            _create: function() {
                this.containerCache = {};
                this._addClass("ui-sortable");
                this.refresh();
                this.offset = this.element.offset();
                this._mouseInit();
                this._setHandleClassName();
                this.ready = true
            },
            _setOption: function(key, value) { this._super(key, value); if (key === "handle") { this._setHandleClassName() } },
            _setHandleClassName: function() {
                var that = this;
                this._removeClass(this.element.find(".ui-sortable-handle"), "ui-sortable-handle");
                $.each(this.items, function() { that._addClass(this.instance.options.handle ? this.item.find(this.instance.options.handle) : this.item, "ui-sortable-handle") })
            },
            _destroy: function() { this._mouseDestroy(); for (var i = this.items.length - 1; i >= 0; i--) { this.items[i].item.removeData(this.widgetName + "-item") } return this },
            _mouseCapture: function(event, overrideHandle) {
                var currentItem = null,
                    validHandle = false,
                    that = this;
                if (this.reverting) { return false }
                if (this.options.disabled || this.options.type === "static") { return false } this._refreshItems(event);
                $(event.target).parents().each(function() { if ($.data(this, that.widgetName + "-item") === that) { currentItem = $(this); return false } });
                if ($.data(event.target, that.widgetName + "-item") === that) { currentItem = $(event.target) }
                if (!currentItem) { return false }
                if (this.options.handle && !overrideHandle) { $(this.options.handle, currentItem).find("*").addBack().each(function() { if (this === event.target) { validHandle = true } }); if (!validHandle) { return false } } this.currentItem = currentItem;
                this._removeCurrentsFromItems();
                return true
            },
            _mouseStart: function(event, overrideHandle, noActivation) {
                var i, body, o = this.options;
                this.currentContainer = this;
                this.refreshPositions();
                this.helper = this._createHelper(event);
                this._cacheHelperProportions();
                this._cacheMargins();
                this.scrollParent = this.helper.scrollParent();
                this.offset = this.currentItem.offset();
                this.offset = { top: this.offset.top - this.margins.top, left: this.offset.left - this.margins.left };
                $.extend(this.offset, { click: { left: event.pageX - this.offset.left, top: event.pageY - this.offset.top }, parent: this._getParentOffset(), relative: this._getRelativeOffset() });
                this.helper.css("position", "absolute");
                this.cssPosition = this.helper.css("position");
                this.originalPosition = this._generatePosition(event);
                this.originalPageX = event.pageX;
                this.originalPageY = event.pageY;
                o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt);
                this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
                if (this.helper[0] !== this.currentItem[0]) { this.currentItem.hide() } this._createPlaceholder();
                if (o.containment) { this._setContainment() }
                if (o.cursor && o.cursor !== "auto") {
                    body = this.document.find("body");
                    this.storedCursor = body.css("cursor");
                    body.css("cursor", o.cursor);
                    this.storedStylesheet = $("<style>*{ cursor: " + o.cursor + " !important; }</style>").appendTo(body)
                }
                if (o.opacity) { if (this.helper.css("opacity")) { this._storedOpacity = this.helper.css("opacity") } this.helper.css("opacity", o.opacity) }
                if (o.zIndex) { if (this.helper.css("zIndex")) { this._storedZIndex = this.helper.css("zIndex") } this.helper.css("zIndex", o.zIndex) }
                if (this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") { this.overflowOffset = this.scrollParent.offset() } this._trigger("start", event, this._uiHash());
                if (!this._preserveHelperProportions) { this._cacheHelperProportions() }
                if (!noActivation) { for (i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, this._uiHash(this)) } }
                if ($.ui.ddmanager) { $.ui.ddmanager.current = this }
                if ($.ui.ddmanager && !o.dropBehaviour) { $.ui.ddmanager.prepareOffsets(this, event) } this.dragging = true;
                this._addClass(this.helper, "ui-sortable-helper");
                this._mouseDrag(event);
                return true
            },
            _mouseDrag: function(event) {
                var i, item, itemElement, intersection, o = this.options,
                    scrolled = false;
                this.position = this._generatePosition(event);
                this.positionAbs = this._convertPositionTo("absolute");
                if (!this.lastPositionAbs) { this.lastPositionAbs = this.positionAbs }
                if (this.options.scroll) { if (this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") { if (this.overflowOffset.top + this.scrollParent[0].offsetHeight - event.pageY < o.scrollSensitivity) { this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed } else if (event.pageY - this.overflowOffset.top < o.scrollSensitivity) { this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed } if (this.overflowOffset.left + this.scrollParent[0].offsetWidth - event.pageX < o.scrollSensitivity) { this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed } else if (event.pageX - this.overflowOffset.left < o.scrollSensitivity) { this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed } } else { if (event.pageY - this.document.scrollTop() < o.scrollSensitivity) { scrolled = this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed) } else if (this.window.height() - (event.pageY - this.document.scrollTop()) < o.scrollSensitivity) { scrolled = this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed) } if (event.pageX - this.document.scrollLeft() < o.scrollSensitivity) { scrolled = this.document.scrollLeft(this.document.scrollLeft() - o.scrollSpeed) } else if (this.window.width() - (event.pageX - this.document.scrollLeft()) < o.scrollSensitivity) { scrolled = this.document.scrollLeft(this.document.scrollLeft() + o.scrollSpeed) } } if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) { $.ui.ddmanager.prepareOffsets(this, event) } } this.positionAbs = this._convertPositionTo("absolute");
                if (!this.options.axis || this.options.axis !== "y") { this.helper[0].style.left = this.position.left + "px" }
                if (!this.options.axis || this.options.axis !== "x") { this.helper[0].style.top = this.position.top + "px" }
                for (i = this.items.length - 1; i >= 0; i--) {
                    item = this.items[i];
                    itemElement = item.item[0];
                    intersection = this._intersectsWithPointer(item);
                    if (!intersection) { continue }
                    if (item.instance !== this.currentContainer) { continue }
                    if (itemElement !== this.currentItem[0] && this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement && !$.contains(this.placeholder[0], itemElement) && (this.options.type === "semi-dynamic" ? !$.contains(this.element[0], itemElement) : true)) { this.direction = intersection === 1 ? "down" : "up"; if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) { this._rearrange(event, item) } else { break } this._trigger("change", event, this._uiHash()); break }
                }
                this._contactContainers(event);
                if ($.ui.ddmanager) { $.ui.ddmanager.drag(this, event) } this._trigger("sort", event, this._uiHash());
                this.lastPositionAbs = this.positionAbs;
                return false
            },
            _mouseStop: function(event, noPropagation) {
                if (!event) { return }
                if ($.ui.ddmanager && !this.options.dropBehaviour) { $.ui.ddmanager.drop(this, event) }
                if (this.options.revert) {
                    var that = this,
                        cur = this.placeholder.offset(),
                        axis = this.options.axis,
                        animation = {};
                    if (!axis || axis === "x") { animation.left = cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollLeft) }
                    if (!axis || axis === "y") { animation.top = cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollTop) } this.reverting = true;
                    $(this.helper).animate(animation, parseInt(this.options.revert, 10) || 500, function() { that._clear(event) })
                } else { this._clear(event, noPropagation) }
                return false
            },
            cancel: function() {
                if (this.dragging) {
                    this._mouseUp(new $.Event("mouseup", { target: null }));
                    if (this.options.helper === "original") {
                        this.currentItem.css(this._storedCSS);
                        this._removeClass(this.currentItem, "ui-sortable-helper")
                    } else { this.currentItem.show() }
                    for (var i = this.containers.length - 1; i >= 0; i--) {
                        this.containers[i]._trigger("deactivate", null, this._uiHash(this));
                        if (this.containers[i].containerCache.over) {
                            this.containers[i]._trigger("out", null, this._uiHash(this));
                            this.containers[i].containerCache.over = 0
                        }
                    }
                }
                if (this.placeholder) { if (this.placeholder[0].parentNode) { this.placeholder[0].parentNode.removeChild(this.placeholder[0]) } if (this.options.helper !== "original" && this.helper && this.helper[0].parentNode) { this.helper.remove() } $.extend(this, { helper: null, dragging: false, reverting: false, _noFinalSort: null }); if (this.domPosition.prev) { $(this.domPosition.prev).after(this.currentItem) } else { $(this.domPosition.parent).prepend(this.currentItem) } }
                return this
            },
            serialize: function(o) {
                var items = this._getItemsAsjQuery(o && o.connected),
                    str = [];
                o = o || {};
                $(items).each(function() { var res = ($(o.item || this).attr(o.attribute || "id") || "").match(o.expression || /(.+)[\-=_](.+)/); if (res) { str.push((o.key || res[1] + "[]") + "=" + (o.key && o.expression ? res[1] : res[2])) } });
                if (!str.length && o.key) { str.push(o.key + "=") }
                return str.join("&")
            },
            toArray: function(o) {
                var items = this._getItemsAsjQuery(o && o.connected),
                    ret = [];
                o = o || {};
                items.each(function() { ret.push($(o.item || this).attr(o.attribute || "id") || "") });
                return ret
            },
            _intersectsWith: function(item) {
                var x1 = this.positionAbs.left,
                    x2 = x1 + this.helperProportions.width,
                    y1 = this.positionAbs.top,
                    y2 = y1 + this.helperProportions.height,
                    l = item.left,
                    r = l + item.width,
                    t = item.top,
                    b = t + item.height,
                    dyClick = this.offset.click.top,
                    dxClick = this.offset.click.left,
                    isOverElementHeight = this.options.axis === "x" || y1 + dyClick > t && y1 + dyClick < b,
                    isOverElementWidth = this.options.axis === "y" || x1 + dxClick > l && x1 + dxClick < r,
                    isOverElement = isOverElementHeight && isOverElementWidth;
                if (this.options.tolerance === "pointer" || this.options.forcePointerForContainers || this.options.tolerance !== "pointer" && this.helperProportions[this.floating ? "width" : "height"] > item[this.floating ? "width" : "height"]) { return isOverElement } else { return l < x1 + this.helperProportions.width / 2 && x2 - this.helperProportions.width / 2 < r && t < y1 + this.helperProportions.height / 2 && y2 - this.helperProportions.height / 2 < b }
            },
            _intersectsWithPointer: function(item) {
                var verticalDirection, horizontalDirection, isOverElementHeight = this.options.axis === "x" || this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
                    isOverElementWidth = this.options.axis === "y" || this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
                    isOverElement = isOverElementHeight && isOverElementWidth;
                if (!isOverElement) { return false } verticalDirection = this._getDragVerticalDirection();
                horizontalDirection = this._getDragHorizontalDirection();
                return this.floating ? horizontalDirection === "right" || verticalDirection === "down" ? 2 : 1 : verticalDirection && (verticalDirection === "down" ? 2 : 1)
            },
            _intersectsWithSides: function(item) {
                var isOverBottomHalf = this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + item.height / 2, item.height),
                    isOverRightHalf = this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + item.width / 2, item.width),
                    verticalDirection = this._getDragVerticalDirection(),
                    horizontalDirection = this._getDragHorizontalDirection();
                if (this.floating && horizontalDirection) { return horizontalDirection === "right" && isOverRightHalf || horizontalDirection === "left" && !isOverRightHalf } else { return verticalDirection && (verticalDirection === "down" && isOverBottomHalf || verticalDirection === "up" && !isOverBottomHalf) }
            },
            _getDragVerticalDirection: function() { var delta = this.positionAbs.top - this.lastPositionAbs.top; return delta !== 0 && (delta > 0 ? "down" : "up") },
            _getDragHorizontalDirection: function() { var delta = this.positionAbs.left - this.lastPositionAbs.left; return delta !== 0 && (delta > 0 ? "right" : "left") },
            refresh: function(event) {
                this._refreshItems(event);
                this._setHandleClassName();
                this.refreshPositions();
                return this
            },
            _connectWith: function() { var options = this.options; return options.connectWith.constructor === String ? [options.connectWith] : options.connectWith },
            _getItemsAsjQuery: function(connected) {
                var i, j, cur, inst, items = [],
                    queries = [],
                    connectWith = this._connectWith();
                if (connectWith && connected) { for (i = connectWith.length - 1; i >= 0; i--) { cur = $(connectWith[i], this.document[0]); for (j = cur.length - 1; j >= 0; j--) { inst = $.data(cur[j], this.widgetFullName); if (inst && inst !== this && !inst.options.disabled) { queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), inst]) } } } } queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]);

                function addItems() { items.push(this) }
                for (i = queries.length - 1; i >= 0; i--) { queries[i][0].each(addItems) }
                return $(items)
            },
            _removeCurrentsFromItems: function() {
                var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
                this.items = $.grep(this.items, function(item) { for (var j = 0; j < list.length; j++) { if (list[j] === item.item[0]) { return false } } return true })
            },
            _refreshItems: function(event) {
                this.items = [];
                this.containers = [this];
                var i, j, cur, inst, targetData, _queries, item, queriesLength, items = this.items,
                    queries = [
                        [$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]
                    ],
                    connectWith = this._connectWith();
                if (connectWith && this.ready) {
                    for (i = connectWith.length - 1; i >= 0; i--) {
                        cur = $(connectWith[i], this.document[0]);
                        for (j = cur.length - 1; j >= 0; j--) {
                            inst = $.data(cur[j], this.widgetFullName);
                            if (inst && inst !== this && !inst.options.disabled) {
                                queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
                                this.containers.push(inst)
                            }
                        }
                    }
                }
                for (i = queries.length - 1; i >= 0; i--) {
                    targetData = queries[i][1];
                    _queries = queries[i][0];
                    for (j = 0, queriesLength = _queries.length; j < queriesLength; j++) {
                        item = $(_queries[j]);
                        item.data(this.widgetName + "-item", targetData);
                        items.push({ item: item, instance: targetData, width: 0, height: 0, left: 0, top: 0 })
                    }
                }
            },
            refreshPositions: function(fast) {
                this.floating = this.items.length ? this.options.axis === "x" || this._isFloating(this.items[0].item) : false;
                if (this.offsetParent && this.helper) { this.offset.parent = this._getParentOffset() }
                var i, item, t, p;
                for (i = this.items.length - 1; i >= 0; i--) {
                    item = this.items[i];
                    if (item.instance !== this.currentContainer && this.currentContainer && item.item[0] !== this.currentItem[0]) { continue } t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
                    if (!fast) {
                        item.width = t.outerWidth();
                        item.height = t.outerHeight()
                    }
                    p = t.offset();
                    item.left = p.left;
                    item.top = p.top
                }
                if (this.options.custom && this.options.custom.refreshContainers) { this.options.custom.refreshContainers.call(this) } else {
                    for (i = this.containers.length - 1; i >= 0; i--) {
                        p = this.containers[i].element.offset();
                        this.containers[i].containerCache.left = p.left;
                        this.containers[i].containerCache.top = p.top;
                        this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
                        this.containers[i].containerCache.height = this.containers[i].element.outerHeight()
                    }
                }
                return this
            },
            _createPlaceholder: function(that) {
                that = that || this;
                var className, o = that.options;
                if (!o.placeholder || o.placeholder.constructor === String) {
                    className = o.placeholder;
                    o.placeholder = {
                        element: function() {
                            var nodeName = that.currentItem[0].nodeName.toLowerCase(),
                                element = $("<" + nodeName + ">", that.document[0]);
                            that._addClass(element, "ui-sortable-placeholder", className || that.currentItem[0].className)._removeClass(element, "ui-sortable-helper");
                            if (nodeName === "tbody") { that._createTrPlaceholder(that.currentItem.find("tr").eq(0), $("<tr>", that.document[0]).appendTo(element)) } else if (nodeName === "tr") { that._createTrPlaceholder(that.currentItem, element) } else if (nodeName === "img") { element.attr("src", that.currentItem.attr("src")) }
                            if (!className) { element.css("visibility", "hidden") }
                            return element
                        },
                        update: function(container, p) { if (className && !o.forcePlaceholderSize) { return } if (!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop") || 0, 10) - parseInt(that.currentItem.css("paddingBottom") || 0, 10)) } if (!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft") || 0, 10) - parseInt(that.currentItem.css("paddingRight") || 0, 10)) } }
                    }
                }
                that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem));
                that.currentItem.after(that.placeholder);
                o.placeholder.update(that, that.placeholder)
            },
            _createTrPlaceholder: function(sourceTr, targetTr) {
                var that = this;
                sourceTr.children().each(function() { $("<td>&#160;</td>", that.document[0]).attr("colspan", $(this).attr("colspan") || 1).appendTo(targetTr) })
            },
            _contactContainers: function(event) {
                var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, floating, axis, innermostContainer = null,
                    innermostIndex = null;
                for (i = this.containers.length - 1; i >= 0; i--) {
                    if ($.contains(this.currentItem[0], this.containers[i].element[0])) { continue }
                    if (this._intersectsWith(this.containers[i].containerCache)) {
                        if (innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) { continue } innermostContainer = this.containers[i];
                        innermostIndex = i
                    } else {
                        if (this.containers[i].containerCache.over) {
                            this.containers[i]._trigger("out", event, this._uiHash(this));
                            this.containers[i].containerCache.over = 0
                        }
                    }
                }
                if (!innermostContainer) { return }
                if (this.containers.length === 1) {
                    if (!this.containers[innermostIndex].containerCache.over) {
                        this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
                        this.containers[innermostIndex].containerCache.over = 1
                    }
                } else {
                    dist = 1e4;
                    itemWithLeastDistance = null;
                    floating = innermostContainer.floating || this._isFloating(this.currentItem);
                    posProperty = floating ? "left" : "top";
                    sizeProperty = floating ? "width" : "height";
                    axis = floating ? "pageX" : "pageY";
                    for (j = this.items.length - 1; j >= 0; j--) {
                        if (!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) { continue }
                        if (this.items[j].item[0] === this.currentItem[0]) { continue } cur = this.items[j].item.offset()[posProperty];
                        nearBottom = false;
                        if (event[axis] - cur > this.items[j][sizeProperty] / 2) { nearBottom = true }
                        if (Math.abs(event[axis] - cur) < dist) {
                            dist = Math.abs(event[axis] - cur);
                            itemWithLeastDistance = this.items[j];
                            this.direction = nearBottom ? "up" : "down"
                        }
                    }
                    if (!itemWithLeastDistance && !this.options.dropOnEmpty) { return }
                    if (this.currentContainer === this.containers[innermostIndex]) {
                        if (!this.currentContainer.containerCache.over) {
                            this.containers[innermostIndex]._trigger("over", event, this._uiHash());
                            this.currentContainer.containerCache.over = 1
                        }
                        return
                    }
                    itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
                    this._trigger("change", event, this._uiHash());
                    this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
                    this.currentContainer = this.containers[innermostIndex];
                    this.options.placeholder.update(this.currentContainer, this.placeholder);
                    this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
                    this.containers[innermostIndex].containerCache.over = 1
                }
            },
            _createHelper: function(event) {
                var o = this.options,
                    helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : o.helper === "clone" ? this.currentItem.clone() : this.currentItem;
                if (!helper.parents("body").length) { $(o.appendTo !== "parent" ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]) }
                if (helper[0] === this.currentItem[0]) { this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") } }
                if (!helper[0].style.width || o.forceHelperSize) { helper.width(this.currentItem.width()) }
                if (!helper[0].style.height || o.forceHelperSize) { helper.height(this.currentItem.height()) }
                return helper
            },
            _adjustOffsetFromHelper: function(obj) { if (typeof obj === "string") { obj = obj.split(" ") } if ($.isArray(obj)) { obj = { left: +obj[0], top: +obj[1] || 0 } } if ("left" in obj) { this.offset.click.left = obj.left + this.margins.left } if ("right" in obj) { this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left } if ("top" in obj) { this.offset.click.top = obj.top + this.margins.top } if ("bottom" in obj) { this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top } },
            _getParentOffset: function() {
                this.offsetParent = this.helper.offsetParent();
                var po = this.offsetParent.offset();
                if (this.cssPosition === "absolute" && this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) {
                    po.left += this.scrollParent.scrollLeft();
                    po.top += this.scrollParent.scrollTop()
                }
                if (this.offsetParent[0] === this.document[0].body || this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie) { po = { top: 0, left: 0 } }
                return { top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0) }
            },
            _getRelativeOffset: function() { if (this.cssPosition === "relative") { var p = this.currentItem.position(); return { top: p.top - (parseInt(this.helper.css("top"), 10) || 0) + this.scrollParent.scrollTop(), left: p.left - (parseInt(this.helper.css("left"), 10) || 0) + this.scrollParent.scrollLeft() } } else { return { top: 0, left: 0 } } },
            _cacheMargins: function() { this.margins = { left: parseInt(this.currentItem.css("marginLeft"), 10) || 0, top: parseInt(this.currentItem.css("marginTop"), 10) || 0 } },
            _cacheHelperProportions: function() { this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() } },
            _setContainment: function() {
                var ce, co, over, o = this.options;
                if (o.containment === "parent") { o.containment = this.helper[0].parentNode }
                if (o.containment === "document" || o.containment === "window") { this.containment = [0 - this.offset.relative.left - this.offset.parent.left, 0 - this.offset.relative.top - this.offset.parent.top, o.containment === "document" ? this.document.width() : this.window.width() - this.helperProportions.width - this.margins.left, (o.containment === "document" ? this.document.height() || document.body.parentNode.scrollHeight : this.window.height() || this.document[0].body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top] }
                if (!/^(document|window|parent)$/.test(o.containment)) {
                    ce = $(o.containment)[0];
                    co = $(o.containment).offset();
                    over = $(ce).css("overflow") !== "hidden";
                    this.containment = [co.left + (parseInt($(ce).css("borderLeftWidth"), 10) || 0) + (parseInt($(ce).css("paddingLeft"), 10) || 0) - this.margins.left, co.top + (parseInt($(ce).css("borderTopWidth"), 10) || 0) + (parseInt($(ce).css("paddingTop"), 10) || 0) - this.margins.top, co.left + (over ? Math.max(ce.scrollWidth, ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"), 10) || 0) - (parseInt($(ce).css("paddingRight"), 10) || 0) - this.helperProportions.width - this.margins.left, co.top + (over ? Math.max(ce.scrollHeight, ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"), 10) || 0) - (parseInt($(ce).css("paddingBottom"), 10) || 0) - this.helperProportions.height - this.margins.top]
                }
            },
            _convertPositionTo: function(d, pos) {
                if (!pos) { pos = this.position }
                var mod = d === "absolute" ? 1 : -1,
                    scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,
                    scrollIsRootNode = /(html|body)/i.test(scroll[0].tagName);
                return { top: pos.top + this.offset.relative.top * mod + this.offset.parent.top * mod - (this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : scrollIsRootNode ? 0 : scroll.scrollTop()) * mod, left: pos.left + this.offset.relative.left * mod + this.offset.parent.left * mod - (this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft()) * mod }
            },
            _generatePosition: function(event) {
                var top, left, o = this.options,
                    pageX = event.pageX,
                    pageY = event.pageY,
                    scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,
                    scrollIsRootNode = /(html|body)/i.test(scroll[0].tagName);
                if (this.cssPosition === "relative" && !(this.scrollParent[0] !== this.document[0] && this.scrollParent[0] !== this.offsetParent[0])) { this.offset.relative = this._getRelativeOffset() }
                if (this.originalPosition) {
                    if (this.containment) { if (event.pageX - this.offset.click.left < this.containment[0]) { pageX = this.containment[0] + this.offset.click.left } if (event.pageY - this.offset.click.top < this.containment[1]) { pageY = this.containment[1] + this.offset.click.top } if (event.pageX - this.offset.click.left > this.containment[2]) { pageX = this.containment[2] + this.offset.click.left } if (event.pageY - this.offset.click.top > this.containment[3]) { pageY = this.containment[3] + this.offset.click.top } }
                    if (o.grid) {
                        top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
                        pageY = this.containment ? top - this.offset.click.top >= this.containment[1] && top - this.offset.click.top <= this.containment[3] ? top : top - this.offset.click.top >= this.containment[1] ? top - o.grid[1] : top + o.grid[1] : top;
                        left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
                        pageX = this.containment ? left - this.offset.click.left >= this.containment[0] && left - this.offset.click.left <= this.containment[2] ? left : left - this.offset.click.left >= this.containment[0] ? left - o.grid[0] : left + o.grid[0] : left
                    }
                }
                return { top: pageY - this.offset.click.top - this.offset.relative.top - this.offset.parent.top + (this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : scrollIsRootNode ? 0 : scroll.scrollTop()), left: pageX - this.offset.click.left - this.offset.relative.left - this.offset.parent.left + (this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft()) }
            },
            _rearrange: function(event, i, a, hardRefresh) {
                a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], this.direction === "down" ? i.item[0] : i.item[0].nextSibling);
                this.counter = this.counter ? ++this.counter : 1;
                var counter = this.counter;
                this._delay(function() { if (counter === this.counter) { this.refreshPositions(!hardRefresh) } })
            },
            _clear: function(event, noPropagation) {
                this.reverting = false;
                var i, delayedTriggers = [];
                if (!this._noFinalSort && this.currentItem.parent().length) { this.placeholder.before(this.currentItem) } this._noFinalSort = null;
                if (this.helper[0] === this.currentItem[0]) {
                    for (i in this._storedCSS) { if (this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") { this._storedCSS[i] = "" } } this.currentItem.css(this._storedCSS);
                    this._removeClass(this.currentItem, "ui-sortable-helper")
                } else { this.currentItem.show() }
                if (this.fromOutside && !noPropagation) { delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)) }) }
                if ((this.fromOutside || this.domPosition.prev !== this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) { delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()) }) }
                if (this !== this.currentContainer) {
                    if (!noPropagation) {
                        delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()) });
                        delayedTriggers.push(function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)) } }.call(this, this.currentContainer));
                        delayedTriggers.push(function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)) } }.call(this, this.currentContainer))
                    }
                }

                function delayEvent(type, instance, container) { return function(event) { container._trigger(type, event, instance._uiHash(instance)) } }
                for (i = this.containers.length - 1; i >= 0; i--) {
                    if (!noPropagation) { delayedTriggers.push(delayEvent("deactivate", this, this.containers[i])) }
                    if (this.containers[i].containerCache.over) {
                        delayedTriggers.push(delayEvent("out", this, this.containers[i]));
                        this.containers[i].containerCache.over = 0
                    }
                }
                if (this.storedCursor) {
                    this.document.find("body").css("cursor", this.storedCursor);
                    this.storedStylesheet.remove()
                }
                if (this._storedOpacity) { this.helper.css("opacity", this._storedOpacity) }
                if (this._storedZIndex) { this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex) } this.dragging = false;
                if (!noPropagation) { this._trigger("beforeStop", event, this._uiHash()) } this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
                if (!this.cancelHelperRemoval) { if (this.helper[0] !== this.currentItem[0]) { this.helper.remove() } this.helper = null }
                if (!noPropagation) { for (i = 0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event) } this._trigger("stop", event, this._uiHash()) } this.fromOutside = false;
                return !this.cancelHelperRemoval
            },
            _trigger: function() { if ($.Widget.prototype._trigger.apply(this, arguments) === false) { this.cancel() } },
            _uiHash: function(_inst) { var inst = _inst || this; return { helper: inst.helper, placeholder: inst.placeholder || $([]), position: inst.position, originalPosition: inst.originalPosition, offset: inst.positionAbs, item: inst.currentItem, sender: _inst ? _inst.element : null } }
        });
    }(jQuery); 
    return element;
});